Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
notes: avoid leaking duplicate entries
author
Mike Hommey
<mh@glandium.org>
Sun, 25 Aug 2019 05:18:18 +0000
(14:18 +0900)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 26 Aug 2019 17:29:38 +0000
(10:29 -0700)
When add_note is called multiple times with the same key/value pair, the
leaf_node it creates is leaked by notes_tree_insert.
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(from parent 1:
75b2f01
)
diff --git
a/notes.c
b/notes.c
index 532ec37865768d05a31606f495b4f0c1645ea757..3130add61815b2abab35ba0b3f1e5413e5c15d14 100644
(file)
--- a/
notes.c
+++ b/
notes.c
@@
-269,8
+269,10
@@
static int note_tree_insert(struct notes_tree *t, struct int_node *tree,
case PTR_TYPE_NOTE:
if (oideq(&l->key_oid, &entry->key_oid)) {
/* skip concatenation if l == entry */
- if (oideq(&l->val_oid, &entry->val_oid))
+ if (oideq(&l->val_oid, &entry->val_oid)) {
+ free(entry);
return 0;
+ }
ret = combine_notes(&l->val_oid,
&entry->val_oid);