From ef5644ea6ecec4ee6d6254612af2ed58499ac2fe Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 9 Sep 2010 14:02:45 -0500 Subject: [PATCH] diff.c: call regfree to free memory allocated by regcomp when necessary Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- diff.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 93004922d..19b5bf63e 100644 --- a/diff.c +++ b/diff.c @@ -912,7 +912,10 @@ static void free_diff_words_data(struct emit_callback *ecbdata) free (ecbdata->diff_words->minus.orig); free (ecbdata->diff_words->plus.text.ptr); free (ecbdata->diff_words->plus.orig); - free(ecbdata->diff_words->word_regex); + if (ecbdata->diff_words->word_regex) { + regfree(ecbdata->diff_words->word_regex); + free(ecbdata->diff_words->word_regex); + } free(ecbdata->diff_words); ecbdata->diff_words = NULL; } -- 2.30.2