On Mon, Apr 14, 2025 at 13:27:16 +0100, Daniel P. Berrangé wrote:
On Mon, Apr 14, 2025 at 02:25:05PM +0200, Peter Krempa wrote:
> On Mon, Apr 14, 2025 at 13:20:55 +0100, Daniel P. Berrangé via Devel wrote:
> > On Mon, Apr 14, 2025 at 03:06:09PM +0300, Alexander Kuznetsov wrote:
[...]
> > AFAICT in this 'else if' branch, 'path' is
only allocated inside the
> > 'LIBVIRT_NSS_GUEST' condition, so movnig the free outside is
pointless.
> >
> > Rather than adding more "free" calls, I think this code would be
> > improved by declaring 'path' with "g_autofree" and using
> > g_steal_pointer when assigning it to 'leaseFiles[nleaseFiles++]',
> > then existing 'free' calls can be removed.
>
> IIUC the NSS module code is supposed to be glib-free to avoid pulling it
> into the code that uses lookups.
Oh yes, but we can still use attribute(cleanup) directly though without
glib. Or even just #define g_autofree locally so we match the codestyle
Yes; defining it locally or using attribute(cleanup) directly will
definitely work. Although I'd suggest to not use 'g_autofree' as name as
then it could evoke the impression that the code does use glib.