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

Re: [PATCH] commit-graph: fix memory leak

From
Emily Shaffer <emilyshaffer@google.com>
Date
May 6, 2019, 21:58 UTC
Message-ID
<20190506215831.GB85211@google.com>
In-Reply-To
<f4ab2a50873b2fd91926d7401f784479504d1b10.1557178485.git.steadmon@google.com>
Hi,

This change looks good to me, and like good evidence for the benefits of automated tooling :)

Thanks!
 - Emily
On Mon, May 06, 2019 at 02:36:58PM -0700, Josh Steadmon wrote:
Show 27 quoted lines
> Free the commit graph when verify_commit_graph_lite() reports an error.
> Credit to OSS-Fuzz for finding this leak.
> 
> Signed-off-by: Josh Steadmon <steadmon@google.com>
> ---
>  commit-graph.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/commit-graph.c b/commit-graph.c
> index 66865acbd7..4bce70d35c 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -267,8 +267,10 @@ struct commit_graph *parse_commit_graph(void *graph_map, int fd,
>  		last_chunk_offset = chunk_offset;
>  	}
>  
> -	if (verify_commit_graph_lite(graph))
> +	if (verify_commit_graph_lite(graph)) {
> +		free(graph);
>  		return NULL;
> +	}
>  
>  	return graph;
>  }
> -- 
> 2.21.0.1020.gf2820cf01a-goog
> 
Previous: Josh SteadmonNext: Derrick Stolee
Message 2 of 5 in “commit-graph: fix memory leak”
  1. commit-graph: fix memory leakJosh Steadmon, May 6, 2019
  2. Emily ShafferMay 6, 2019
  3. Derrick StoleeMay 7, 2019
  4. Ævar Arnfjörð BjarmasonMay 7, 2019
  5. Jeff KingMay 7, 2019

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.