From: Junio C Hamano Date: Wed, 25 Jul 2012 18:01:12 +0000 (-0700) Subject: help.c::exclude_cmds(): plug a leak X-Git-Tag: v1.7.12-rc1~12^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6a17f583f4db98a867d84ca95bbbc4de3cd0feaa;p=git.git 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 --- diff --git a/help.c b/help.c index 699149201..2a42ec6d1 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++; }