[PATCH 1/2] uncompress: fix uncompress_buf usage
Sascha Hauer
s.hauer at pengutronix.de
Thu Dec 8 04:45:18 EST 2011
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 at pengutronix.de>
---
lib/uncompress.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/uncompress.c b/lib/uncompress.c
index 80982f3..beb96d1 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;
}
--
1.7.7.3
More information about the barebox
mailing list