diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-12-08 09:35:32 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-12-08 13:46:32 +0100 |
commit | 4bc6ff2f6518a1e2e4a952a1b70be388d57e1a6a (patch) | |
tree | 7b995b7a046925106d5c5067df87e54f6ac3b917 /lib | |
parent | 3180d4b3e321b827ecf6851853ef67531b84eff7 (diff) | |
download | barebox-4bc6ff2f6518a1e2e4a952a1b70be388d57e1a6a.tar.gz barebox-4bc6ff2f6518a1e2e4a952a1b70be388d57e1a6a.tar.xz |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/uncompress.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/uncompress.c b/lib/uncompress.c index 80982f34d6..beb96d167a 100644 --- a/lib/uncompress.c +++ b/lib/uncompress.c @@ -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; } |