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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: last (?) round of memleaks
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 6 Sep 2022 12:16:15 +0200

Download raw body.

Thread
On Tue, Sep 06, 2022 at 12:11:16PM +0200, Omar Polo wrote:
> played again a bit with gotwebd under valgrind and found some other
> leaks.  two are in gotwebd and the others in lib/.
> 
> some of the got_repo_get_* functions allocate a string that we forget
> to free.  I did a round of checking and fixed the ones that were
> (possibly) leaking memory.  Should we consider to rename some of this
> functions to avoid the ambiguity?  (some of the got_repo_get_* returns
> const char *, other don't.)

The return type (const char * vs. char *) should be enough to
allow people to tell. Or just look into the implementation.

> @@ -923,6 +928,8 @@ done:
>  	got_ref_list_free(&refs);
>  	if (commit)
>  		got_object_commit_close(commit);
> +	if (tree)
> +		got_object_tree_close(commit);

That doesn't look right (tree vs. commit)