mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] uncompress: fix uncompress_buf usage
@ 2011-12-08  9:45 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2011-12-08  9:45 UTC (permalink / raw)
  To: barebox

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>
---
 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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-08  9:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-08  9:45 [PATCH 1/2] uncompress: fix uncompress_buf usage Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox