From 6a17f583f4db98a867d84ca95bbbc4de3cd0feaa Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 25 Jul 2012 11:01:12 -0700 Subject: 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 --- help.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'help.c') 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++; } -- cgit v1.2.3