git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] bisect: fix memory leak and document `find_bisection()`

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 2, 2017, 04:54 UTC
Message-ID
<xmqqr2thqnzw.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<4795556016c25e4a78241362547c5468877f808d.1509557518.git.martin.agren@gmail.com>
Martin Ågren <martin.agren@gmail.com> writes:
Show 7 quoted lines
> `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.
Show 10 quoted lines
> +/*
> + * 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);
Previous: Martin ÅgrenNext: Martin Ågren
Message 4 of 10 in “bisect: fix memory leak and document `find_bisection()`”
  1. 1/3 bisect: fix memory leak and document `find_bisection()`Martin Ågren, Nov 1, 2017
  2. 2/3 bisect: fix off-by-one error in `best_bisection_sorted()`Martin Ågren, Nov 1, 2017
  3. 3/3 bisect: fix memory leak when returning best elementMartin Ågren, Nov 1, 2017
  4. Junio C HamanoNov 2, 2017
  5. Martin ÅgrenNov 2, 2017
  6. 0/4 bisect: assorted leak-fixesMartin Ågren, Nov 5, 2017
  7. 1/4 bisect: change calling-convention of `find_bisection()`Martin Ågren, Nov 5, 2017
  8. 2/4 bisect: fix memory leak in `find_bisection()`Martin Ågren, Nov 5, 2017
  9. 3/4 bisect: fix off-by-one error in `best_bisection_sorted()`Martin Ågren, Nov 5, 2017
  10. 4/4 bisect: fix memory leak when returning best elementMartin Ågren, Nov 5, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.