aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-09-09 17:29:40 -0700
committerJunio C Hamano <gitster@pobox.com>2010-09-09 17:29:40 -0700
commit8ac8cf5bc17ef11a9c5d51ab128ad010cb37c464 (patch)
tree7412604a665890a9ce4dbeaac0cca3406f2ba7ca
parentbff42061214e17f342efc909c73f29bf66df51e9 (diff)
parent1b6ecbad3511b1aaa65172ef8b520dd3b5141614 (diff)
downloadgit-8ac8cf5bc17ef11a9c5d51ab128ad010cb37c464.tar.gz
git-8ac8cf5bc17ef11a9c5d51ab128ad010cb37c464.tar.xz
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
-rw-r--r--diff.c5
-rw-r--r--xdiff-interface.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/diff.c b/diff.c
index 144f2aaba..9a5c77c13 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;
}
diff --git a/xdiff-interface.c b/xdiff-interface.c
index cd2285de1..e1e054e4d 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -286,9 +286,8 @@ static long ff_regexp(const char *line, long len,
result = pmatch[i].rm_eo - pmatch[i].rm_so;
if (result > buffer_size)
result = buffer_size;
- else
- while (result > 0 && (isspace(line[result - 1])))
- result--;
+ while (result > 0 && (isspace(line[result - 1])))
+ result--;
memcpy(buffer, line, result);
fail:
free(line_buffer);