- Fix - buf is assigned to to cm->cm_data with is defined 'uint8_t cm_data[CWS_NETMSGSIZE];' part of the cwc_message_t, never malloc'd and should be free'd

(cherry picked from commit 61491f394a)
This commit is contained in:
Benny Morgan 2013-06-30 21:49:08 +02:00 committed by Adam Sutton
parent 2b8c6d67d4
commit 879f0c1059
2 changed files with 3 additions and 6 deletions

View file

@ -497,7 +497,6 @@ cwc_send_msg(cwc_t *cwc, const uint8_t *msg, size_t len, int sid, int enq)
buf[5] = sid;
if((len = des_encrypt(buf, len, cwc)) <= 0) {
free(buf);
free(cm);
return -1;
}

View file

@ -78,18 +78,16 @@ static uint8_t *_fb_inflate ( const uint8_t *data, size_t size, size_t orig )
{
int err;
z_stream zstr;
uint8_t *bufin, *bufout;
uint8_t *bufout;
/* Setup buffers */
bufin = malloc(size);
bufout = malloc(orig);
memcpy(bufin, data, size);
/* Setup zlib */
memset(&zstr, 0, sizeof(zstr));
inflateInit2(&zstr, 31);
zstr.avail_in = size;
zstr.next_in = bufin;
zstr.next_in = data;
zstr.avail_out = orig;
zstr.next_out = bufout;
@ -99,7 +97,7 @@ static uint8_t *_fb_inflate ( const uint8_t *data, size_t size, size_t orig )
free(bufout);
bufout = NULL;
}
free(bufin);
inflateEnd(&zstr);
return bufout;