git.droids-corp.org
/
libcmdline.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c417552
)
genconf: fix memory corruption in error cases
author
Olivier Matz
<zer0@droids-corp.org>
Sun, 20 Feb 2011 16:58:01 +0000
(17:58 +0100)
committer
Olivier Matz
<zer0@droids-corp.org>
Sun, 13 Mar 2011 10:09:25 +0000
(11:09 +0100)
Signed-off-by: Olivier Matz <zer0@droids-corp.org>
src/genconf/parse_confnode.c
patch
|
blob
|
history
diff --git
a/src/genconf/parse_confnode.c
b/src/genconf/parse_confnode.c
index
033e45d
..
2a9ed06
100644
(file)
--- a/
src/genconf/parse_confnode.c
+++ b/
src/genconf/parse_confnode.c
@@
-198,6
+198,7
@@
complete_conf_node_start(cmdline_parse_token_hdr_t *tk,
unsigned flags = tkd->flags;
unsigned mask = tkd->mask;
+ *opaque = NULL;
cb = malloc(sizeof(*cb));
if (cb == NULL)
return -1;
@@
-241,7
+242,8
@@
complete_conf_node_iterate(cmdline_parse_token_hdr_t *tk, void **opaque,
static void
complete_conf_node_end(cmdline_parse_token_hdr_t *tk, void **opaque)
{
- free(*opaque);
+ if (*opaque)
+ free(*opaque);
}
int help_conf_node(cmdline_parse_token_hdr_t *tk, char *dstbuf, unsigned int size)