X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=diff.c;h=340d878f02b0daa3b26cf5eb3bf71bdda1437ce2;hb=ae3cdfe1123d153f720bbe4a4abc97ed3e9f65a4;hp=144f2aaba85682ef44d307d2b015fd918336879b;hpb=e3efa9c12c1797f5eeb140ebeb44ff6d210ec215;p=git.git diff --git a/diff.c b/diff.c index 144f2aaba..340d878f0 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; } @@ -3307,7 +3310,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) else if ((argcount = parse_long_opt("output", av, &optarg))) { options->file = fopen(optarg, "w"); if (!options->file) - die_errno("Could not open '%s'", arg + strlen("--output=")); + die_errno("Could not open '%s'", optarg); options->close_file = 1; return argcount; } else @@ -3524,7 +3527,7 @@ static void diff_flush_stat(struct diff_filepair *p, struct diff_options *o, if ((DIFF_FILE_VALID(p->one) && S_ISDIR(p->one->mode)) || (DIFF_FILE_VALID(p->two) && S_ISDIR(p->two->mode))) - return; /* no tree diffs in patch format */ + return; /* no useful stat for tree diffs */ run_diffstat(p, o, diffstat); } @@ -3537,7 +3540,7 @@ static void diff_flush_checkdiff(struct diff_filepair *p, if ((DIFF_FILE_VALID(p->one) && S_ISDIR(p->one->mode)) || (DIFF_FILE_VALID(p->two) && S_ISDIR(p->two->mode))) - return; /* no tree diffs in patch format */ + return; /* nothing to check in tree diffs */ run_checkdiff(p, o); }