Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
help.c::exclude_cmds(): plug a leak
author
Junio C Hamano
<gitster@pobox.com>
Wed, 25 Jul 2012 18:01:12 +0000
(11:01 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 25 Jul 2012 18:08:59 +0000
(11:08 -0700)
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>
help.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
4a15758
)
diff --git
a/help.c
b/help.c
index 699149201ed72070492247a6fb3da213de8e0808..2a42ec6d1f312b573d7b1da1a15471d21efc5b4d 100644
(file)
--- 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++;
}