checkout,merge: loosen overwriting untracked file check based on info/exclude
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 144f2aaba85682ef44d307d2b015fd918336879b..9a5c77c13ff3406a85e8a94f309a639529f2d88b 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -919,7 +919,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;
        }