threads / patch / 59632

patchFix memory leak in get_reachable_subset

Subject: [PATCH] Fix memory leak in get_reachable_subset

## tl;dr

4 messages between Apr 22, 2023 and Apr 24, 2023. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Mike Hommey· Apr 21, 2023, 23:44 UTC · lore
---
 commit-reach.c | 2 ++
 1 file changed, 2 insertions(+)
Show changes to commit-reach.c +2 −0
diff --git a/commit-reach.c b/commit-reach.c
index 70bde8af05..f15d84566b 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
 		}
 	}
 
+	clear_prio_queue(&queue);
+
 	clear_commit_marks_many(nr_to, to, PARENT1);
 	clear_commit_marks_many(nr_from, from, PARENT2);
 
-- 
2.39.0.1.g6739ec1790
Derrick Stolee· Apr 24, 2023, 15:21 UTC · re: Mike Hommey · lore

Re: [PATCH] Fix memory leak in get_reachable_subset

On 4/21/2023 7:44 PM, Mike Hommey wrote:
Show 6 quoted lines
> @@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
>  		}
>  	}
>  
> +	clear_prio_queue(&queue);
> +

Thanks. This is a leak that has existed since the method was first created in fcb2c0769db (commit-reach: implement get_reachable_subset, 2018-11-02). I appreciate the attention to detail.

-Stolee
Junio C Hamano· Apr 24, 2023, 16:09 UTC · re: Mike Hommey · lore

Re: [PATCH] Fix memory leak in get_reachable_subset

Mike Hommey <mh@glandium.org> writes:
> ---
>  commit-reach.c | 2 ++
>  1 file changed, 2 insertions(+)
Missing sign-off?

[jc: adding the author of fcb2c076 (commit-reach: implement get_reachable_subset, 2018-11-02) to the CC list]

Show 12 quoted lines
> diff --git a/commit-reach.c b/commit-reach.c
> index 70bde8af05..f15d84566b 100644
> --- a/commit-reach.c
> +++ b/commit-reach.c
> @@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
>  		}
>  	}
>  
> +	clear_prio_queue(&queue);
> +
>  	clear_commit_marks_many(nr_to, to, PARENT1);
>  	clear_commit_marks_many(nr_from, from, PARENT2);
Looking good.
Mike Hommey· Apr 24, 2023, 20:41 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix memory leak in get_reachable_subset

On Mon, Apr 24, 2023 at 09:09:33AM -0700, Junio C Hamano wrote:
Show 7 quoted lines
> Mike Hommey <mh@glandium.org> writes:
> 
> > ---
> >  commit-reach.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> Missing sign-off?

Gah. Sorry, I forgot it in this and another patch I sent a few days ago ([PATCH] Handle compiler versions containing a dash)

Do you want full resends or is it okay if I just add
  Signed-off-by: Mike Hommey <mh@glandium.org>
here?
Mike

← back to recent threads