Code

git-reset.txt: reset does not change files in target
[git.git] / diff.c
diff --git a/diff.c b/diff.c
index 93004922dee5b4f148dc8e6be5be469f1ffe75e6..19b5bf63ed37aa49c00e63f7aec621ce601b6daa 100644 (file)
--- 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;
        }