From: Jeff King Date: Mon, 12 Jun 2023 03:48:31 GMT Subject: Re: [PATCH 07/11] branch: fix a leak in inherit_tracking Message-ID: <20230612034831.GG306352@coredump.intra.peff.net> In-Reply-To: <25e68755-7073-9523-dacc-d79e4e10eb39@gmail.com> On Sun, Jun 11, 2023 at 08:50:16PM +0200, Rubén Justo wrote: > Actually, the string we're strdup()'ing is from the struct branch > returned by get_branch(). Which, in turn, retrieves the string from the > global "struct repository". This makes perfectly valid to use the > string throughout the entire execution of create_branch(). There is no > need to duplicate it. > > Let's fix the leak, removing the strdup(). Yep, good reasoning. I agree this is a good way to fix the leak. -Peff