Fix some memory leaks
This commit is contained in:
parent
01faa32420
commit
542702482d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user