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:
parent
5ddd073621
commit
5956233917
1 changed files with 5 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue