diff --git a/src/cwc.c b/src/cwc.c index ffcc44fc..4e75077c 100644 --- a/src/cwc.c +++ b/src/cwc.c @@ -508,7 +508,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; } diff --git a/src/filebundle.c b/src/filebundle.c index 295ed00f..0ea7f324 100644 --- a/src/filebundle.c +++ b/src/filebundle.c @@ -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;