From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjemli at gmail.com (Lars Hjemli) Date: Thu, 7 Apr 2011 12:38:50 +0200 Subject: Fixes for several memory leaks In-Reply-To: <20110407103025.GA20089@blizzard> References: <20110402201844.GA20067@blizzard> <20110405085128.GA27120@blizzard> <20110407103025.GA20089@blizzard> Message-ID: On Thu, Apr 7, 2011 at 12:30, Lukas Fleischer wrote: > On Thu, Apr 07, 2011 at 12:15:19PM +0200, Lars Hjemli wrote: >> +++ b/ui-diff.c >> @@ -368,8 +368,10 @@ void cgit_print_diff(const char *new_rev, const char *old_r >> ? ? ? ? ? ? ? ? return; >> ? ? ? ? } >> ? ? ? ? commit = lookup_commit_reference(new_rev_sha1); >> - ? ? ? if (!commit || parse_commit(commit)) >> + ? ? ? if (!commit || parse_commit(commit)) { >> ? ? ? ? ? ? ? ? cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1) >> + ? ? ? ? ? ? ? return; >> + ? ? ? } >> >> ? ? ? ? if (old_rev) >> ? ? ? ? ? ? ? ? get_sha1(old_rev, old_rev_sha1); > > Yeah, I wasn't sure since there are other "Bad commit" error handlers > below that do not "return;" as well, whereas all other error handlers > do. My assumption that this is intended and execution should continue in > this case (maybe to build the remaining page properly and display the > error message somewhere inbetween). No, the two missing returns (I only saw the first, thanks for noticing) are simply bugs. -- larsh