summaryrefslogtreecommitdiff
path: root/tree-diff.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2007-12-11 21:59:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-12 18:59:22 (GMT)
commit03b69c7606267bc978c69cf88fcd7a8edf8175bc (patch)
tree7305a71d161adf2d7db014cacea71916dc8b874d /tree-diff.c
parentb0fe0d7258951779b790190b10ca21ffc5573546 (diff)
downloadgit-03b69c7606267bc978c69cf88fcd7a8edf8175bc.zip
git-03b69c7606267bc978c69cf88fcd7a8edf8175bc.tar.gz
git-03b69c7606267bc978c69cf88fcd7a8edf8175bc.tar.bz2
Fix small memory leaks induced by diff_tree_setup_paths
Run diff_tree_release_paths in the appropriate places, and add a test to avoid NULL dereference. Better safe than sorry. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-diff.c')
-rw-r--r--tree-diff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tree-diff.c b/tree-diff.c
index aa0a100..e1e2e6c 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -326,6 +326,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
die("unable to set up diff options to follow renames");
diff_tree(t1, t2, base, &diff_opts);
diffcore_std(&diff_opts);
+ diff_tree_release_paths(&diff_opts);
/* Go through the new set of filepairing, and see if we find a more interesting one */
for (i = 0; i < q->nr; i++) {
@@ -342,6 +343,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
choice = p;
/* Update the path we use from now on.. */
+ diff_tree_release_paths(opt);
opt->paths[0] = xstrdup(p->one->path);
diff_tree_setup_paths(opt->paths, opt);
break;