Re: [PATCH 07/11] branch: fix a leak in inherit_tracking
From: Jeff King <hidden>
Date: 2023-06-12 03:48:36
From: Jeff King <hidden>
Date: 2023-06-12 03:48:36
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