diff --git a/libc/serdes.c b/libc/serdes.c index 9f26c71..3a99ee0 100644 --- a/libc/serdes.c +++ b/libc/serdes.c @@ -39,10 +39,8 @@ void* deserialize_ptr(serdes_state* state) { } void* deserialize_ary(size_t len,serdes_state* state) { - void* ary_in_buf=((void*)(state->buf+state->sizeorpos)); + void* ary=((void*)(state->buf+state->sizeorpos)); state->sizeorpos+=len; - void* ary=malloc(len); - memcpy(ary,ary_in_buf,len); return ary; } diff --git a/tar_fs/main.c b/tar_fs/main.c index 9ec0ac1..0eb76d2 100644 --- a/tar_fs/main.c +++ b/tar_fs/main.c @@ -123,6 +123,7 @@ void read(void* args) { state.sizeorpos=0; serialize_int(size,&state); serialize_ary(data,size,&state); + free(data); rpc_return(state.buf,state.sizeorpos); free(state.buf); pthread_exit(NULL);