summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-25 18:01:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-07-25 18:08:59 (GMT)
commit6a17f583f4db98a867d84ca95bbbc4de3cd0feaa (patch)
tree503306d80c9ded10d2f8309d055350b1f45d63c5
parent4a15758f2ef97970694012cfd6da7c8449bc68c2 (diff)
downloadgit-6a17f583f4db98a867d84ca95bbbc4de3cd0feaa.zip
git-6a17f583f4db98a867d84ca95bbbc4de3cd0feaa.tar.gz
git-6a17f583f4db98a867d84ca95bbbc4de3cd0feaa.tar.bz2
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>
-rw-r--r--help.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/help.c b/help.c
index 6991492..2a42ec6 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++;
}