X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=diff.c;h=9a5c77c13ff3406a85e8a94f309a639529f2d88b;hb=3fcb88785da831ad7d53cf18b4398099179c9c87;hp=6fb97d4623192167e9b9f83b02dfe9250f028c0a;hpb=633142d86874ee8ce79a23ee4346f32e6271faad;p=git.git diff --git a/diff.c b/diff.c index 6fb97d462..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; } @@ -3853,6 +3856,13 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1) len2, p->two->path); git_SHA1_Update(&ctx, buffer, len1); + if (diff_filespec_is_binary(p->one) || + diff_filespec_is_binary(p->two)) { + git_SHA1_Update(&ctx, sha1_to_hex(p->one->sha1), 40); + git_SHA1_Update(&ctx, sha1_to_hex(p->two->sha1), 40); + continue; + } + xpp.flags = 0; xecfg.ctxlen = 3; xecfg.flags = XDL_EMIT_FUNCNAMES;