{"thread":{"id":"64650","subject":"[PATCH] repository: cache->squash_msg is freed twice","startedAt":"2025-12-18T15:26:08Z","lastAt":"2025-12-19T03:52:13Z","messageCount":4,"participants":["AZero13 via GitGitGadget","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"532473","messageId":"pull.2132.git.git.1766071566022.gitgitgadget@gmail.com","threadId":"64650","inReplyTo":null,"subject":"[PATCH] repository: cache->squash_msg is freed twice","fromName":"AZero13 via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-12-18T15:26:06Z","receivedAt":"2025-12-18T15:26:08Z","isPatch":true,"sender":{"key":"name:AZero13","avatar":null},"body":"From: Greg Funni <gfunni234@gmail.com>\n\nThankfully, it is set to NULL, so no security consequences.\nHowever, this is still a mistake that must be rectified.\n\nSigned-off-by: Greg Funni <gfunni234@gmail.com>\n---\n    repository: cache->squash_msg is freed twice\n    \n    Thankfully, it is set to NULL, so no security consequences.\n    \n    However, this is still a mistake that must be rectified.\n    \n    Signed-off-by: Greg Funni gfunni234@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2132%2FAZero13%2Ftwice-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2132/AZero13/twice-v1\nPull-Request: https://github.com/git/git/pull/2132\n\n repository.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/repository.c b/repository.c\nindex 863f24411b..c7e75215ac 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -349,7 +349,6 @@ out:\n \n static void repo_clear_path_cache(struct repo_path_cache *cache)\n {\n-\tFREE_AND_NULL(cache->squash_msg);\n \tFREE_AND_NULL(cache->squash_msg);\n \tFREE_AND_NULL(cache->merge_msg);\n \tFREE_AND_NULL(cache->merge_rr);\n\nbase-commit: c4a0c8845e2426375ad257b6c221a3a7d92ecfda\n-- \ngitgitgadget\n"},{"id":"532474","messageId":"pull.2132.v2.git.git.1766072952115.gitgitgadget@gmail.com","threadId":"64650","inReplyTo":"pull.2132.git.git.1766071566022.gitgitgadget@gmail.com","subject":"[PATCH v2] repository: remove duplicate free of cache->squash_msg","fromName":"AZero13 via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-12-18T15:49:12Z","receivedAt":"2025-12-18T15:49:14Z","isPatch":true,"sender":{"key":"name:AZero13","avatar":null},"body":"From: Greg Funni <gfunni234@gmail.com>\n\nThankfully, it is set to NULL, so no security consequences.\nHowever, this is still a mistake that must be rectified.\n\nSigned-off-by: Greg Funni <gfunni234@gmail.com>\n---\n    repository: remove duplicate free of cache->squash_msg\n    \n    Thankfully, it is set to NULL, so no security consequences.\n    \n    However, this is still a mistake that must be rectified.\n    \n    Signed-off-by: Greg Funni gfunni234@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2132%2FAZero13%2Ftwice-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2132/AZero13/twice-v2\nPull-Request: https://github.com/git/git/pull/2132\n\nRange-diff vs v1:\n\n 1:  35d0606190 ! 1:  ac2abd592d repository: cache->squash_msg is freed twice\n     @@ Metadata\n      Author: Greg Funni <gfunni234@gmail.com>\n      \n       ## Commit message ##\n     -    repository: cache->squash_msg is freed twice\n     +    repository: remove duplicate free of cache->squash_msg\n      \n          Thankfully, it is set to NULL, so no security consequences.\n          However, this is still a mistake that must be rectified.\n\n\n repository.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/repository.c b/repository.c\nindex 863f24411b..c7e75215ac 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -349,7 +349,6 @@ out:\n \n static void repo_clear_path_cache(struct repo_path_cache *cache)\n {\n-\tFREE_AND_NULL(cache->squash_msg);\n \tFREE_AND_NULL(cache->squash_msg);\n \tFREE_AND_NULL(cache->merge_msg);\n \tFREE_AND_NULL(cache->merge_rr);\n\nbase-commit: c4a0c8845e2426375ad257b6c221a3a7d92ecfda\n-- \ngitgitgadget\n"},{"id":"532495","messageId":"CAPig+cRsKGERBk2pVotrKhhy5FCmmrQODTJEgkO8GuTY2SLbiA@mail.gmail.com","threadId":"64650","inReplyTo":"pull.2132.git.git.1766071566022.gitgitgadget@gmail.com","subject":"Re: [PATCH] repository: cache->squash_msg is freed twice","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2025-12-18T18:18:32Z","receivedAt":"2025-12-18T18:18:44Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Dec 18, 2025 at 10:26 AM AZero13 via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n> Thankfully, it is set to NULL, so no security consequences.\n> However, this is still a mistake that must be rectified.\n>\n> Signed-off-by: Greg Funni <gfunni234@gmail.com>\n> ---\n> diff --git a/repository.c b/repository.c\n> @@ -349,7 +349,6 @@ out:\n>  static void repo_clear_path_cache(struct repo_path_cache *cache)\n>  {\n> -       FREE_AND_NULL(cache->squash_msg);\n>         FREE_AND_NULL(cache->squash_msg);\n>         FREE_AND_NULL(cache->merge_msg);\n>         FREE_AND_NULL(cache->merge_rr);\n\nThis mistake has been present since Ævar added this function in\n759f340738 (repository.c: free the \"path cache\" in repo_clear(),\n2022-03-04), so it isn't the result of someone else coming along and\nadding a new field to the structure which needs freeing but then\nbotching the call to FREE_AND_NULL(). Moreover, this function does\nfree all the freeable members of repo_path_cache, hence, nothing is\nbeing leaked, so it must have just been a silly copy/paste mistake in\nthe first place. Hence, this change makes sense.\n"},{"id":"532513","messageId":"xmqq4ipnxh5h.fsf@gitster.g","threadId":"64650","inReplyTo":"CAPig+cRsKGERBk2pVotrKhhy5FCmmrQODTJEgkO8GuTY2SLbiA@mail.gmail.com","subject":"Re: [PATCH] repository: cache->squash_msg is freed twice","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-12-19T03:52:10Z","receivedAt":"2025-12-19T03:52:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Thu, Dec 18, 2025 at 10:26 AM AZero13 via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n>> Thankfully, it is set to NULL, so no security consequences.\n>> However, this is still a mistake that must be rectified.\n>>\n>> Signed-off-by: Greg Funni <gfunni234@gmail.com>\n>> ---\n>> diff --git a/repository.c b/repository.c\n>> @@ -349,7 +349,6 @@ out:\n>>  static void repo_clear_path_cache(struct repo_path_cache *cache)\n>>  {\n>> -       FREE_AND_NULL(cache->squash_msg);\n>>         FREE_AND_NULL(cache->squash_msg);\n>>         FREE_AND_NULL(cache->merge_msg);\n>>         FREE_AND_NULL(cache->merge_rr);\n>\n> This mistake has been present since Ævar added this function in\n> 759f340738 (repository.c: free the \"path cache\" in repo_clear(),\n> 2022-03-04), so it isn't the result of someone else coming along and\n> adding a new field to the structure which needs freeing but then\n> botching the call to FREE_AND_NULL(). Moreover, this function does\n> free all the freeable members of repo_path_cache, hence, nothing is\n> being leaked, so it must have just been a silly copy/paste mistake in\n> the first place. Hence, this change makes sense.\n\nThanks, both.  Will queue.\n\n"}]}