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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: refactor got_pathlist_free() to optionally free path and data pointers
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Tue, 10 Jan 2023 09:45:49 +0100

Download raw body.

Thread
On Tue, Jan 10, 2023 at 05:54:22PM +1100, Mark Jamsek wrote:
> On 23-01-09 03:53PM, Stefan Sperling wrote:
> > On Tue, Jan 10, 2023 at 01:28:23AM +1100, Mark Jamsek wrote:
> > > As briefly discussed with stsp, refactor got_pathlist_free() to
> > > optionally free member pointers.
> > > 
> > > Although this touches a lot of code, the change is quite simple.
> > > According to grep I haven't missed anything, but there's always
> > > a non-zero chance I haven't got the translation right in every case!
> > 
> > I went through and did spot one conversion problem. See below.
> > 
> 
> Thanks! The below diff is rebased on top of main. I've added your fixes
> plus two more things:
> 
>   1. set path and data pointers to NULL in got_pathlist_free()
>   2. added GOT_PATHLIST_FREE_ALL shortcut for
>      GOT_PATHLIST_FREE_{data,path}
> 
> The first for a little double-free safety-net, and the second purely
> because it saves some wrapping (and some typing in the future :), but
> I can drop this if you prefer?

I don't mind having the extra flag. ok.