On Mon, Mar 08, 2021 at 06:36:17PM +0000, Andrzej Hunt via GitGitGadget wrote: > Make sure that we release the temporary strbuf during dwim_branch() for > all codepaths (and not just for the early return). Makes sense. Two style nits: > static const char *dwim_branch(const char *path, const char **new_branch) > { > - int n; > + int n, branch_exists; If two variables aren't strictly related, but just happen to share the same type, IMHO it's better to declare them separately. (There are numerous spots in Git's code that don't follow this rule, but I think we should be moving in that direction). > - if (!strbuf_check_branch_ref(&ref, branchname) && > - ref_exists(ref.buf)) { > - strbuf_release(&ref); > + > + branch_exists = (!strbuf_check_branch_ref(&ref, branchname) && > + ref_exists(ref.buf)); We'd usually omit the extra parentheses here. I.e.,: branch_exists = !strbuf_check_branch_ref(&ref, branchname) && ref_exists(ref.buf); -Peff