From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] hush: fix nasty memory leak in hush
Date: Fri, 8 Oct 2010 14:24:33 +0200 [thread overview]
Message-ID: <1286540674-17174-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1286540674-17174-1-git-send-email-s.hauer@pengutronix.de>
Fix memory leak in globbing part of hush. a simple '['
on the command line was enough to trigger it.
We must call globfree() before setting the glob structure
to zero.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/hush.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/common/hush.c b/common/hush.c
index f22eca6..1b5cd99 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -790,6 +790,7 @@ static int globhack(const char *src, int flags, glob_t *pglob)
}
dest = xmalloc(cnt);
if (!(flags & GLOB_APPEND)) {
+ globfree(pglob);
pglob->gl_pathv = NULL;
pglob->gl_pathc = 0;
pglob->gl_offs = 0;
--
1.7.2.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-10-08 12:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 12:24 Sascha Hauer
2010-10-08 12:24 ` [PATCH 1/3] hush: pass context around in shell Sascha Hauer
2010-10-08 12:24 ` Sascha Hauer [this message]
2010-10-08 12:24 ` [PATCH 3/3] hush: implement getopt builtin Sascha Hauer
2010-10-08 12:36 ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-08 12:45 ` Sascha Hauer
2010-10-11 5:08 ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-08 13:31 ` [PATCH 3/3 v2] " Sascha Hauer
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=1286540674-17174-3-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