summaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-07-25 11:01:12 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-07-25 11:08:59 -0700
commit6a17f583f4db98a867d84ca95bbbc4de3cd0feaa (patch)
tree503306d80c9ded10d2f8309d055350b1f45d63c5 /help.c
parenthelp.c::uniq: plug a leak (diff)
downloadtgif-6a17f583f4db98a867d84ca95bbbc4de3cd0feaa.tar.xz
help.c::exclude_cmds(): plug a leak
Command name removed from the list of commands via the exclusion were overwritten and lost without being freed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'help.c')
-rw-r--r--help.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/help.c b/help.c
index 699149201e..2a42ec6d1f 100644
--- a/help.c
+++ b/help.c
@@ -64,9 +64,10 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name);
if (cmp < 0)
cmds->names[cj++] = cmds->names[ci++];
- else if (cmp == 0)
- ci++, ei++;
- else if (cmp > 0)
+ else if (cmp == 0) {
+ ei++;
+ free(cmds->names[ci++]);
+ } else if (cmp > 0)
ei++;
}