]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2010 00:29:40 +0000 (17:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2010 00:29:40 +0000 (17:29 -0700)
* maint:
  xdiff-interface.c: always trim trailing space from xfuncname matches
  diff.c: call regfree to free memory allocated by regcomp when necessary

diff.c
xdiff-interface.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;
        }
index cd2285de1cb1faa9f7c6c97dd22210f20bb046a3..e1e054e4d982de30d8a9c8c4109c6d62448f62a9 100644 (file)
@@ -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);