aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2010-09-09 14:02:45 -0500
committerJunio C Hamano <gitster@pobox.com>2010-09-09 17:18:04 -0700
commitef5644ea6ecec4ee6d6254612af2ed58499ac2fe (patch)
tree692beb9f7a48a4f74a74a22b7f39095d1d3e8db4 /diff.c
parent04df568be53c42d07aea393effc7c5653f245d9a (diff)
downloadgit-ef5644ea6ecec4ee6d6254612af2ed58499ac2fe.tar.gz
git-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 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;
}