Skip to content

Commit ef5644e

Browse files
drafnelgitster
authored andcommitted
diff.c: call regfree to free memory allocated by regcomp when necessary
Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 04df568 commit ef5644e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

diff.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,10 @@ static void free_diff_words_data(struct emit_callback *ecbdata)
912912
free (ecbdata->diff_words->minus.orig);
913913
free (ecbdata->diff_words->plus.text.ptr);
914914
free (ecbdata->diff_words->plus.orig);
915-
free(ecbdata->diff_words->word_regex);
915+
if (ecbdata->diff_words->word_regex) {
916+
regfree(ecbdata->diff_words->word_regex);
917+
free(ecbdata->diff_words->word_regex);
918+
}
916919
free(ecbdata->diff_words);
917920
ecbdata->diff_words = NULL;
918921
}

0 commit comments

Comments
 (0)