summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d249b45)
raw | patch | inline | side by side (parent: d249b45)
author | Rene Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Fri, 4 Aug 2006 08:54:08 +0000 (10:54 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 4 Aug 2006 09:08:20 +0000 (02:08 -0700) |
Free the root tree object buffer when we're done, plugging a minor leak
in generate_tar(). Note: we cannot simply free(tree.buf) because this
pointer is modified by tree_entry() calls in traverse_tree().
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
in generate_tar(). Note: we cannot simply free(tree.buf) because this
pointer is modified by tree_entry() calls in traverse_tree().
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-tar-tree.c | patch | blob | history |
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index 7c48db9ec85adb1b8866b2cc1dc0eccd2d1816c7..215892b6967ab3b42ef3826e3e934001de1f5162 100644 (file)
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
struct commit *commit;
struct tree_desc tree;
struct strbuf current_path;
+ void *buffer;
current_path.buf = xmalloc(PATH_MAX);
current_path.alloc = PATH_MAX;
} else
archive_time = time(NULL);
- tree.buf = read_object_with_reference(sha1, tree_type, &tree.size,
- tree_sha1);
+ tree.buf = buffer = read_object_with_reference(sha1, tree_type,
+ &tree.size, tree_sha1);
if (!tree.buf)
die("not a reference to a tag, commit or tree object: %s",
sha1_to_hex(sha1));
write_entry(tree_sha1, ¤t_path, 040777, NULL, 0);
traverse_tree(&tree, ¤t_path);
write_trailer();
+ free(buffer);
free(current_path.buf);
return 0;
}