diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-07-25 11:01:12 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-07-25 11:08:59 -0700 |
commit | 6a17f583f4db98a867d84ca95bbbc4de3cd0feaa (patch) | |
tree | 503306d80c9ded10d2f8309d055350b1f45d63c5 /help.c | |
parent | 4a15758f2ef97970694012cfd6da7c8449bc68c2 (diff) | |
download | git-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.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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++; } |