filebundle: reverse changes made in PR283

The zlib input buffer is not defined const, therefore the extra malloc/memcpy
is required.
This commit is contained in:
Adam Sutton 2013-07-05 09:33:49 +01:00
parent 5ddd073621
commit 5956233917

View file

@ -78,16 +78,18 @@ static uint8_t *_fb_inflate ( const uint8_t *data, size_t size, size_t orig )
{
int err;
z_stream zstr;
uint8_t *bufout;
uint8_t *bufin, *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 = data;
zstr.next_in = bufin;
zstr.avail_out = orig;
zstr.next_out = bufout;
@ -97,7 +99,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;