From: ctmbl via GitGitGadget Date: Wed, 22 Mar 2023 09:42:06 GMT Subject: [PATCH 2/2] Fix mem leak in branch.c due to not-free newly added virtual_name variable Message-ID: <27f27f3afd76fc974350c0c94e20307879eead84.1679478126.git.gitgitgadget@gmail.com> In-Reply-To: From: ctmbl Previous commit introduced virtual_name variable which is the name of the branch in case it has been a remote ref (used to check whether the user simply forgot `--remote` flag) but didn't free it. Call FREE_AND_NULL(virtual_name) to solve it. Signed-off-by: Clement Mabileau --- builtin/branch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/branch.c b/builtin/branch.c index 8e768761b9b..697636e2874 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -279,6 +279,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds, | RESOLVE_REF_NO_RECURSE | RESOLVE_REF_ALLOW_BAD_NAME, &oid, &flags); + FREE_AND_NULL(virtual_name); if (virtual_target) error(_(MISSING_BRANCH_HINT_MSG), bname.buf); else -- gitgitgadget