diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-10-08 14:18:31 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-10-08 14:18:37 +0200 |
commit | 97b2a33c50b69acdf9fd0ea3f1fb303c7fd38372 (patch) | |
tree | a1c0cc644fed1058422d3a9723e0f3ba8646c2d1 /common/hush.c | |
parent | dff63d23996cafc649ecc8798b1cda13470dad6d (diff) | |
download | barebox-97b2a33c50b69acdf9fd0ea3f1fb303c7fd38372.tar.gz barebox-97b2a33c50b69acdf9fd0ea3f1fb303c7fd38372.tar.xz |
hush: fix nasty memory leak in hush
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>
Diffstat (limited to 'common/hush.c')
-rw-r--r-- | common/hush.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/common/hush.c b/common/hush.c index f22eca66fa..1b5cd992c9 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; |