[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Is there a bug in headerFree? (rpm-4.0.3)



On Wed, Jul 04, 2001 at 09:16:17AM -0400, Jeff Johnson wrote:
> On Wed, Jul 04, 2001 at 03:24:54PM +0200, David Odin wrote:
> > 
> >   Hi,
> > 
> > I'm trying to print all the installed packages.
> > The following program used to work with rpm-4.0.
> > Now, it segfault on headerFree().
> > It works well if I comment out the call to headerFree(), but I guess it then
> > leaks some memory.
> > 
> 
> No, deleting the headerFree() is the right thing to do, and it won't leak
> memory.
> 
> You don't have to do headerFree() within the scope of rpmdbNextIterator(),
> as the reference count is owned by the iterator.
> 
  The strange things is that this used to work with previous version of rpm.

> > shouldn't we free headers in rpm-4.0.3 anymore?
> > 
> 
> Alternatively, if you wish to use the Header outside of the while loop,
> you should do
> 	h = headerLink(h)
> inside the loop to bump the reference count on the Header. You'll need to do
> a matching headerFree() later, or that will leak memory.
> 
    Thanks a lot.

             Regards,

                    DindinX

-- 
  odin@mandrakesoft.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []