summaryrefslogtreecommitdiff
path: root/read-tree.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-05-11 23:16:23 +0200
committerPetr Baudis <xpasky@machine.sinus.cz>2005-05-11 23:16:23 +0200
commit14242464811bff9e8d1af8eb33367a01480a18d0 (patch)
tree6e210814049e8d47389a53d579cfdb27972f9285 /read-tree.c
parentc599caca3ab7d5d66d7cadbbf589c2e4b5587d3e (diff)
downloadgit-14242464811bff9e8d1af8eb33367a01480a18d0.tar.gz
Fixed a leak in read-tree
unpack_tree() would not free the tree object it has read.
Diffstat (limited to 'read-tree.c')
-rw-r--r--read-tree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/read-tree.c b/read-tree.c
index f8dc509a1f..f6298e5c21 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -11,11 +11,14 @@ static int unpack_tree(unsigned char *sha1)
{
void *buffer;
unsigned long size;
+ int ret;
buffer = read_object_with_reference(sha1, "tree", &size, 0);
if (!buffer)
return -1;
- return read_tree(buffer, size, stage);
+ ret = read_tree(buffer, size, stage);
+ free(buffer);
+ return ret;
}
static char *lockfile_name;