Thread (73 messages) flat view 73 messages, 8 authors, 2016-06-15
STALE3750d

Revision v4 of 3 in this series.

Revisions (3)
  1. v4 current
  2. v5 [diff vs current]
  3. v6 [diff vs current]

[PATCH v4 07/45] unpack-trees: plug a memory leak

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:57:37
Subsystem: the rest · Maintainer: Linus Torvalds

Before overwriting the destination index, first let's discard its
contents.

Signed-off-by: Felipe Contreras <redacted>
---
 unpack-trees.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index 57b4074..abe2576 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1166,8 +1166,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 
 	o->src_index = NULL;
 	ret = check_updates(o) ? (-2) : 0;
-	if (o->dst_index)
+	if (o->dst_index) {
+		discard_index(o->dst_index);
 		*o->dst_index = o->result;
+	}
 
 done:
 	clear_exclude_list(&el);
-- 
1.8.3.698.g079b096
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help