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>

Junio C Hamano committed Jul 25, 2012 at 11:01 UTC 6a17f583f4db98a867d84ca95bbbc4de3cd0feaa
1 file changed +4 -3
help.c
+4 -3
@@ -64,9 +64,10 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
64 cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name);
65 if (cmp < 0)
66 cmds->names[cj++] = cmds->names[ci++];
67 - else if (cmp == 0)
68 - ci++, ei++;
69 - else if (cmp > 0)
67 + else if (cmp == 0) {
68 + ei++;
69 + free(cmds->names[ci++]);
70 + } else if (cmp > 0)
71 ei++;
72 }
73