summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-22 19:45:48 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-22 19:45:48 -0800
commit09a5d72d8e8308fa5505e8c5d4715c0b6a5eabcb (patch)
tree38c3025d8b91b2d17f8a8941725361c8196bd69f /diffcore-rename.c
parent6dc78e696b8597204b903073da932fc5ed0f419e (diff)
downloadgit-09a5d72d8e8308fa5505e8c5d4715c0b6a5eabcb.tar.gz
diffcore-rename: plug memory leak.
Spotted by Nicolas Pitre. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 39d9126cb9..ffd126af0d 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -176,8 +176,10 @@ static int estimate_similarity(struct diff_filespec *src,
/* A delta that has a lot of literal additions would have
* big delta_size no matter what else it does.
*/
- if (base_size * (MAX_SCORE-minimum_score) < delta_size * MAX_SCORE)
+ if (base_size * (MAX_SCORE-minimum_score) < delta_size * MAX_SCORE) {
+ free(delta);
return 0;
+ }
/* Estimate the edit size by interpreting delta. */
if (count_delta(delta, delta_size, &src_copied, &literal_added)) {