summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorLibravatar Brandon Casey <drafnel@gmail.com>2010-09-09 14:02:45 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-09-09 17:18:04 -0700
commitef5644ea6ecec4ee6d6254612af2ed58499ac2fe (patch)
tree692beb9f7a48a4f74a74a22b7f39095d1d3e8db4 /diff.c
parentrevert: Fix trivial comment style issue (diff)
downloadtgif-ef5644ea6ecec4ee6d6254612af2ed58499ac2fe.tar.xz
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>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 93004922de..19b5bf63ed 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;
}