"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: add diffstat option to got log and tog diff view
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Wed, 4 Jan 2023 13:19:49 +0100

Download raw body.

Thread
On Wed, Jan 04, 2023 at 08:45:22PM +1100, Mark Jamsek wrote:
> > It seems memory for the allocated diffstat changes is leaked here
> > because got_pathlist_free() will not free the 'data' pointer. This is
> > because some callers store pointers in 'data' that cannot be freed.
> > The above code should iterate the pathlist and free pe->data manually
> > before freeing the list itself.
> 
> We already free pe->data above in the queue loop where we write out the
> changeset; line 4711 with the patch applied:
> 
> 	4794	TAILQ_FOREACH(pe, &changed_paths, entry) {
> 	4795		struct got_diff_changed_path *cp = pe->data;
> 	4796		int pad = dsa.max_path_len - pe->path_len + 1;
> 
> 	...		...
> 
> 	4710		free((char *)pe->path);
> 	4711		free(pe->data);
> 	4712	}
> 

Ah yes, I see, thanks. Please disregard my comment then.