From: Junio C Hamano Date: Mon, 23 May 2016 21:54:37 +0000 (-0700) Subject: Merge branch 'jc/rerere-multi' X-Git-Tag: v2.9.0-rc0~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ec34a8b135182ed41786cd87295d7086283dee64 Merge branch 'jc/rerere-multi' * jc/rerere-multi: rerere: remove an null statement rerere: plug memory leaks upon "rerere forget" failure --- ec34a8b135182ed41786cd87295d7086283dee64 diff --cc rerere.c index 1810c040da,d4929a66ae..aaadec17d8 --- a/rerere.c +++ b/rerere.c @@@ -1060,14 -1062,19 +1060,19 @@@ static int rerere_forget_one_path(cons break; } - if (id->collection->status_nr <= id->variant) - return error("no remembered resolution for '%s'", path); + if (id->collection->status_nr <= id->variant) { + error("no remembered resolution for '%s'", path); + goto fail_exit; + } filename = rerere_path(id, "postimage"); - if (unlink(filename)) - return (errno == ENOENT - ? error("no remembered resolution for %s", path) - : error_errno("cannot unlink %s", filename)); + if (unlink(filename)) { + if (errno == ENOENT) + error("no remembered resolution for %s", path); + else - error("cannot unlink %s: %s", filename, strerror(errno)); ++ error_errno("cannot unlink %s", filename); + goto fail_exit; + } /* * Update the preimage so that the user can resolve the