From: Junio C Hamano <gitster@pobox.com>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: git@vger.kernel.org, Christian Couder <christian.couder@gmail.com>
Subject: Re: [PATCH 1/3] bisect: fix memory leak and document `find_bisection()`
Date: Thu, 02 Nov 2017 13:54:27 +0900 [thread overview]
Message-ID: <xmqqr2thqnzw.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <4795556016c25e4a78241362547c5468877f808d.1509557518.git.martin.agren@gmail.com> ("Martin Ågren"'s message of "Wed, 1 Nov 2017 21:34:37 +0100")
Martin Ågren <martin.agren@gmail.com> writes:
> `find_bisection()` rebuilds the commit list it is given by reversing it
> and skipping uninteresting commits. The uninteresting list entries are
> leaked. Free them to fix the leak.
>
> While we're here and understand what's going on, document the function.
> In particular, make sure to document that the original list should not
> be examined by the caller.
Good. Thanks.
I notice that this has only two callers and both of them do
revs.commits = find_bisection(revs.commits, ...);
I wonder if updating its calling convention to
(void) find_bisection(&revs.commits, ...);
makes sense. This is obviously outside the scope of this patch.
> +/*
> + * Find bisection. If something is found, `reaches` will be the number of
> + * commits that the best commit reaches. `all` will be the count of
> + * non-SAMETREE commits. If `find_all` is set, all non-SAMETREE commits are
> + * returned sorted, otherwise only a single best commit is returned. The
> + * original list will be left in an undefined state and should not be examined.
> + */
> extern struct commit_list *find_bisection(struct commit_list *list,
> int *reaches, int *all,
> int find_all);
next prev parent reply other threads:[~2017-11-02 4:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-01 20:34 [PATCH 1/3] bisect: fix memory leak and document `find_bisection()` Martin Ågren
2017-11-01 20:34 ` [PATCH 2/3] bisect: fix off-by-one error in `best_bisection_sorted()` Martin Ågren
2017-11-01 20:34 ` [PATCH 3/3] bisect: fix memory leak when returning best element Martin Ågren
2017-11-02 4:54 ` Junio C Hamano [this message]
2017-11-02 10:47 ` [PATCH 1/3] bisect: fix memory leak and document `find_bisection()` Martin Ågren
2017-11-05 20:24 ` [PATCH v2 0/4] bisect: assorted leak-fixes Martin Ågren
2017-11-05 20:24 ` [PATCH v2 1/4] bisect: change calling-convention of `find_bisection()` Martin Ågren
2017-11-05 20:24 ` [PATCH v2 2/4] bisect: fix memory leak in `find_bisection()` Martin Ågren
2017-11-05 20:24 ` [PATCH v2 3/4] bisect: fix off-by-one error in `best_bisection_sorted()` Martin Ågren
2017-11-05 20:24 ` [PATCH v2 4/4] bisect: fix memory leak when returning best element Martin Ågren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqr2thqnzw.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=martin.agren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).