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>
This commit is contained in:
Mike Hommey
2007-12-11 22:59:55 +01:00
committed by Junio C Hamano
parent b0fe0d7258
commit 03b69c7606
3 changed files with 6 additions and 1 deletions

View File

@ -388,6 +388,7 @@ static struct origin *find_origin(struct scoreboard *sb,
}
}
diff_flush(&diff_opts);
diff_tree_release_paths(&diff_opts);
if (porigin) {
/*
* Create a freestanding copy that is not part of
@ -444,6 +445,7 @@ static struct origin *find_rename(struct scoreboard *sb,
}
}
diff_flush(&diff_opts);
diff_tree_release_paths(&diff_opts);
return porigin;
}
@ -1165,7 +1167,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
}
}
diff_flush(&diff_opts);
diff_tree_release_paths(&diff_opts);
return retval;
}