RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm-5_3: rpm/python/ header-py.c

From: Per Řyvind Karlsen <pkarlsen@rpm5.org>
Date: Thu 27 Jan 2011 - 20:54:50 CET
Message-ID: <AANLkTimzzvfGh28uufquCkLMrGR-2pC+hmUhyGT_x8YL@mail.gmail.com>
2011/1/27 Jeff Johnson <n3npq@mac.com>:
> What is was the warning? If it was return value from headerFree()
> being ignored, then try something simpler like
Yupp, but I thought that I could cut down to just one assignment..
>
>        (void) headerFree(s->h);
>        s->h = NULL;
> (headerFree is perfectly prepared to deal with NULL args, and there
> are almost no cases in any rpm code where the rpmfooFree() return
> is actually needed/used. See rpmio/url.c cache tear down for an example
> of where the non-NULL is actually meaningfully used to eliminate ALL
> references to force an actual free. There's another usage in Fclose(),
> but be forewarned:
>        There are monsters in Fclose().
>
> Note that your change can/will lead to s->h possibly
> being non-null. headerFree() will return NULL iff
> the refcount is 0.
Ah, i thought that headerFree() would always return NULL,
which is why I thought doing only one assignment would be
cleaner..
I guess I should revert this one then..

--
Regards,
Per Řyvind
Received on Thu Jan 27 20:55:08 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.