git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] repository: cache->squash_msg is freed twice
@ 2025-12-18 15:26 AZero13 via GitGitGadget
  2025-12-18 15:49 ` [PATCH v2] repository: remove duplicate free of cache->squash_msg AZero13 via GitGitGadget
  2025-12-18 18:18 ` [PATCH] repository: cache->squash_msg is freed twice Eric Sunshine
  0 siblings, 2 replies; 4+ messages in thread
From: AZero13 via GitGitGadget @ 2025-12-18 15:26 UTC (permalink / raw)
  To: git; +Cc: AZero13, Greg Funni

From: Greg Funni <gfunni234@gmail.com>

Thankfully, it is set to NULL, so no security consequences.
However, this is still a mistake that must be rectified.

Signed-off-by: Greg Funni <gfunni234@gmail.com>
---
    repository: cache->squash_msg is freed twice
    
    Thankfully, it is set to NULL, so no security consequences.
    
    However, this is still a mistake that must be rectified.
    
    Signed-off-by: Greg Funni gfunni234@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2132%2FAZero13%2Ftwice-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2132/AZero13/twice-v1
Pull-Request: https://github.com/git/git/pull/2132

 repository.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/repository.c b/repository.c
index 863f24411b..c7e75215ac 100644
--- a/repository.c
+++ b/repository.c
@@ -349,7 +349,6 @@ out:
 
 static void repo_clear_path_cache(struct repo_path_cache *cache)
 {
-	FREE_AND_NULL(cache->squash_msg);
 	FREE_AND_NULL(cache->squash_msg);
 	FREE_AND_NULL(cache->merge_msg);
 	FREE_AND_NULL(cache->merge_rr);

base-commit: c4a0c8845e2426375ad257b6c221a3a7d92ecfda
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] repository: remove duplicate free of cache->squash_msg
  2025-12-18 15:26 [PATCH] repository: cache->squash_msg is freed twice AZero13 via GitGitGadget
@ 2025-12-18 15:49 ` AZero13 via GitGitGadget
  2025-12-18 18:18 ` [PATCH] repository: cache->squash_msg is freed twice Eric Sunshine
  1 sibling, 0 replies; 4+ messages in thread
From: AZero13 via GitGitGadget @ 2025-12-18 15:49 UTC (permalink / raw)
  To: git; +Cc: AZero13, Greg Funni

From: Greg Funni <gfunni234@gmail.com>

Thankfully, it is set to NULL, so no security consequences.
However, this is still a mistake that must be rectified.

Signed-off-by: Greg Funni <gfunni234@gmail.com>
---
    repository: remove duplicate free of cache->squash_msg
    
    Thankfully, it is set to NULL, so no security consequences.
    
    However, this is still a mistake that must be rectified.
    
    Signed-off-by: Greg Funni gfunni234@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2132%2FAZero13%2Ftwice-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2132/AZero13/twice-v2
Pull-Request: https://github.com/git/git/pull/2132

Range-diff vs v1:

 1:  35d0606190 ! 1:  ac2abd592d repository: cache->squash_msg is freed twice
     @@ Metadata
      Author: Greg Funni <gfunni234@gmail.com>
      
       ## Commit message ##
     -    repository: cache->squash_msg is freed twice
     +    repository: remove duplicate free of cache->squash_msg
      
          Thankfully, it is set to NULL, so no security consequences.
          However, this is still a mistake that must be rectified.


 repository.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/repository.c b/repository.c
index 863f24411b..c7e75215ac 100644
--- a/repository.c
+++ b/repository.c
@@ -349,7 +349,6 @@ out:
 
 static void repo_clear_path_cache(struct repo_path_cache *cache)
 {
-	FREE_AND_NULL(cache->squash_msg);
 	FREE_AND_NULL(cache->squash_msg);
 	FREE_AND_NULL(cache->merge_msg);
 	FREE_AND_NULL(cache->merge_rr);

base-commit: c4a0c8845e2426375ad257b6c221a3a7d92ecfda
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] repository: cache->squash_msg is freed twice
  2025-12-18 15:26 [PATCH] repository: cache->squash_msg is freed twice AZero13 via GitGitGadget
  2025-12-18 15:49 ` [PATCH v2] repository: remove duplicate free of cache->squash_msg AZero13 via GitGitGadget
@ 2025-12-18 18:18 ` Eric Sunshine
  2025-12-19  3:52   ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Sunshine @ 2025-12-18 18:18 UTC (permalink / raw)
  To: AZero13 via GitGitGadget; +Cc: git, Greg Funni

On Thu, Dec 18, 2025 at 10:26 AM AZero13 via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> Thankfully, it is set to NULL, so no security consequences.
> However, this is still a mistake that must be rectified.
>
> Signed-off-by: Greg Funni <gfunni234@gmail.com>
> ---
> diff --git a/repository.c b/repository.c
> @@ -349,7 +349,6 @@ out:
>  static void repo_clear_path_cache(struct repo_path_cache *cache)
>  {
> -       FREE_AND_NULL(cache->squash_msg);
>         FREE_AND_NULL(cache->squash_msg);
>         FREE_AND_NULL(cache->merge_msg);
>         FREE_AND_NULL(cache->merge_rr);

This mistake has been present since Ævar added this function in
759f340738 (repository.c: free the "path cache" in repo_clear(),
2022-03-04), so it isn't the result of someone else coming along and
adding a new field to the structure which needs freeing but then
botching the call to FREE_AND_NULL(). Moreover, this function does
free all the freeable members of repo_path_cache, hence, nothing is
being leaked, so it must have just been a silly copy/paste mistake in
the first place. Hence, this change makes sense.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] repository: cache->squash_msg is freed twice
  2025-12-18 18:18 ` [PATCH] repository: cache->squash_msg is freed twice Eric Sunshine
@ 2025-12-19  3:52   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2025-12-19  3:52 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: AZero13 via GitGitGadget, git, Greg Funni

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Thu, Dec 18, 2025 at 10:26 AM AZero13 via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>> Thankfully, it is set to NULL, so no security consequences.
>> However, this is still a mistake that must be rectified.
>>
>> Signed-off-by: Greg Funni <gfunni234@gmail.com>
>> ---
>> diff --git a/repository.c b/repository.c
>> @@ -349,7 +349,6 @@ out:
>>  static void repo_clear_path_cache(struct repo_path_cache *cache)
>>  {
>> -       FREE_AND_NULL(cache->squash_msg);
>>         FREE_AND_NULL(cache->squash_msg);
>>         FREE_AND_NULL(cache->merge_msg);
>>         FREE_AND_NULL(cache->merge_rr);
>
> This mistake has been present since Ævar added this function in
> 759f340738 (repository.c: free the "path cache" in repo_clear(),
> 2022-03-04), so it isn't the result of someone else coming along and
> adding a new field to the structure which needs freeing but then
> botching the call to FREE_AND_NULL(). Moreover, this function does
> free all the freeable members of repo_path_cache, hence, nothing is
> being leaked, so it must have just been a silly copy/paste mistake in
> the first place. Hence, this change makes sense.

Thanks, both.  Will queue.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-19  3:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-18 15:26 [PATCH] repository: cache->squash_msg is freed twice AZero13 via GitGitGadget
2025-12-18 15:49 ` [PATCH v2] repository: remove duplicate free of cache->squash_msg AZero13 via GitGitGadget
2025-12-18 18:18 ` [PATCH] repository: cache->squash_msg is freed twice Eric Sunshine
2025-12-19  3:52   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).