Skip to content

Commit 8ac8cf5

Browse files
committed
Merge branch 'maint'
* maint: xdiff-interface.c: always trim trailing space from xfuncname matches diff.c: call regfree to free memory allocated by regcomp when necessary
2 parents bff4206 + 1b6ecba commit 8ac8cf5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

diff.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,10 @@ static void free_diff_words_data(struct emit_callback *ecbdata)
919919
free (ecbdata->diff_words->minus.orig);
920920
free (ecbdata->diff_words->plus.text.ptr);
921921
free (ecbdata->diff_words->plus.orig);
922-
free(ecbdata->diff_words->word_regex);
922+
if (ecbdata->diff_words->word_regex) {
923+
regfree(ecbdata->diff_words->word_regex);
924+
free(ecbdata->diff_words->word_regex);
925+
}
923926
free(ecbdata->diff_words);
924927
ecbdata->diff_words = NULL;
925928
}

xdiff-interface.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,8 @@ static long ff_regexp(const char *line, long len,
286286
result = pmatch[i].rm_eo - pmatch[i].rm_so;
287287
if (result > buffer_size)
288288
result = buffer_size;
289-
else
290-
while (result > 0 && (isspace(line[result - 1])))
291-
result--;
289+
while (result > 0 && (isspace(line[result - 1])))
290+
result--;
292291
memcpy(buffer, line, result);
293292
fail:
294293
free(line_buffer);

0 commit comments

Comments
 (0)