What is was the warning? If it was return value from headerFree()
being ignored, then try something simpler like

        (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.

Which is why the code was written as

        if (s->h) headerFree(s->h);
        s->h = NULL;

because you can end-up with a double free later if you do
        s->h = headerFree(s->h);

hth

73 de Jeff

On Jan 27, 2011, at 1:18 PM, Per Øyvind Karlsen wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/
>  ____________________________________________________________________________
> 
>  Server: rpm5.org                         Name:   Per Øyvind Karlsen
>  Root:   /v/rpm/cvs                       Email:  pkarl...@rpm5.org
>  Module: rpm                              Date:   27-Jan-2011 19:18:29
>  Branch: rpm-5_3                          Handle: 2011012718182900
> 
>  Modified files:           (Branch: rpm-5_3)
>    rpm/python              header-py.c
> 
>  Log:
>    fix compile warning
> 
>  Summary:
>    Revision    Changes     Path
>    1.110.2.2   +2  -2      rpm/python/header-py.c
>  ____________________________________________________________________________
> 
>  patch -p0 <<'@@ .'
>  Index: rpm/python/header-py.c
>  ============================================================================
>  $ cvs diff -u -r1.110.2.1 -r1.110.2.2 header-py.c
>  --- rpm/python/header-py.c   9 Dec 2010 07:47:45 -0000       1.110.2.1
>  +++ rpm/python/header-py.c   27 Jan 2011 18:18:29 -0000      1.110.2.2
>  @@ -343,8 +343,8 @@
>   static void hdr_dealloc(hdrObject * s)
>       /*@*/
>   {
>  -    if (s->h) headerFree(s->h);
>  -    s->h = NULL;
>  +    if (s->h) s->h = headerFree(s->h);
>  +    else s->h = NULL;
>       PyObject_Del(s);
>   }
> 
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-...@rpm5.org

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to