diff.c: call regfree to free memory allocated by regcomp when necessary

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Casey 2010-09-09 14:02:45 -05:00 committed by Junio C Hamano
parent 04df568be5
commit ef5644ea6e

5
diff.c
View file

@ -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;
}