From: Rubén Justo Date: Sun, 11 Jun 2023 18:50:45 GMT Subject: [PATCH 10/11] config: fix a leak in git_config_copy_or_rename_section_in_file Message-ID: <3ee93720-dce0-8f90-68bf-0242e5731a36@gmail.com> In-Reply-To: <9eb931e7-dd18-8ce8-4d4a-cf3d85066189@gmail.com> A branch can have its configuration spread over several configuration sections. This situation was already foreseen in 52d59cc645 (branch: add a --copy (-c) option to go with --move (-m), 2017-06-18) when "branch -c" was introduced. Unfortunately, a leak was also introduced: $ git branch foo $ cat >> .git/config < --- config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/config.c b/config.c index 39a7d7422c..207e4394a3 100644 --- a/config.c +++ b/config.c @@ -3833,6 +3833,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename output[0] = '\t'; } } else { + strbuf_release(©str); copystr = store_create_section(new_name, &store); } } -- 2.40.1