9
0
Fork 0

uncompress: fix uncompress_buf usage

uncompress_buf is used each time uncompress is called, so
make sure it is initialized correctly so that we do not
call free() on an already free pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2011-12-08 09:35:32 +01:00
parent 3180d4b3e3
commit 9f0c582950
1 changed files with 2 additions and 1 deletions

View File

@ -84,6 +84,8 @@ int uncompress(unsigned char *inbuf, int len,
if (inbuf) {
ft = file_detect_type(inbuf);
uncompress_buf = NULL;
uncompress_size = 0;
} else {
if (!fill)
return -EINVAL;
@ -127,7 +129,6 @@ int uncompress(unsigned char *inbuf, int len,
flush, output, pos, error_fn);
err:
free(uncompress_buf);
uncompress_size = 0;
return ret;
}