From: Phillip Wood Date: Fri, 09 Feb 2024 11:08:33 GMT Subject: Re: [PATCH] prune: mark rebase autostash and orig-head as reachable Message-ID: <6ed59006-9572-460e-996b-63a1321b3db5@gmail.com> In-Reply-To: Hi Eric On 08/02/2024 17:25, Eric Sunshine wrote: > On Thu, Feb 8, 2024 at 12:00 PM Phillip Wood via GitGitGadget >> +static int add_one_file(const char *path, struct rev_info *revs) >> +{ >> + struct strbuf buf = STRBUF_INIT; >> + >> + if (!read_oneliner(&buf, path, READ_ONELINER_SKIP_IF_EMPTY)) { >> + strbuf_release(&buf); >> + return 0; >> + } >> + strbuf_trim(&buf); >> + if (!get_oid_hex(buf.buf, &oid)) { >> + object = parse_object_or_die(&oid, buf.buf); >> + add_pending_object(revs, object, ""); >> + } >> + return 0; >> +} > > Is this leaking the strbuf? Should the function instead end with: > > strbuf_release(&buf); > return 0; Yes, well spotted > Also, what is the significance of the return value of this function? > All code paths seem to be returning 0 unconditionally, and the caller > ignores the return value. Good point, I think in an earlier draft it returned an error at one point, I'll change the return types. >> +/* Mark objects recored in rebase state files as reachable. */ > > s/recored/recorded/ Sharp eyes as ever, thanks for looking at this I'll re-roll Phillip