Fix some memory leaks

This commit is contained in:
pjht 2020-08-30 09:43:56 -05:00
parent 01faa32420
commit 542702482d
2 changed files with 2 additions and 3 deletions

View File

@ -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;
}

View File

@ -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);