summaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-25 11:01:12 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-25 11:08:59 -0700
commit6a17f583f4db98a867d84ca95bbbc4de3cd0feaa (patch)
tree503306d80c9ded10d2f8309d055350b1f45d63c5 /help.c
parent4a15758f2ef97970694012cfd6da7c8449bc68c2 (diff)
downloadgit-6a17f583f4db98a867d84ca95bbbc4de3cd0feaa.tar.gz
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++;
}