Thread (16 messages) flat view 16 messages, 3 authors, 2016-06-15
DORMANTno replies

[PATCH 1/4] diff.c: call regfree to free memory allocated by regcomp when necessary

From: Brandon Casey <hidden>
Date: 2016-06-15 22:49:31
Subsystem: the rest · Maintainer: Linus Torvalds

From: Brandon Casey <redacted>


Signed-off-by: Brandon Casey <redacted>
---
 diff.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/diff.c b/diff.c
index 144f2aa..9a5c77c 100644
--- 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;
 	}
-- 
1.7.2.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help