From: Junio C Hamano Date: Thu, 23 Feb 2006 03:45:48 +0000 (-0800) Subject: diffcore-rename: plug memory leak. X-Git-Tag: v1.2.4~9^3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=09a5d72d8e8308fa5505e8c5d4715c0b6a5eabcb;p=git.git diffcore-rename: plug memory leak. Spotted by Nicolas Pitre. Signed-off-by: Junio C Hamano --- diff --git a/diffcore-rename.c b/diffcore-rename.c index 39d9126cb..ffd126af0 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)) {