mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] uncompress: fix uncompress_buf usage
Date: Thu,  8 Dec 2011 10:45:18 +0100	[thread overview]
Message-ID: <1323337518-656-1-git-send-email-s.hauer@pengutronix.de> (raw)

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

                 reply	other threads:[~2011-12-08  9:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323337518-656-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox