[Rpm-maint] [rpm-software-management/rpm] Is it necessary to headerUnlink() headers? (#1072)

David Cantrell notifications at github.com
Fri Feb 14 18:37:49 UTC 2020


I use rpmReadPackageFile() to get RPM headers then use headerGetString() and headerIsSource() during the lifetime of the program.  At the end, I call headerFree() on the RPM headers I read in at the beginning but these are not freed because the reference counts are at 67.  I see headerUnlink() is not available directly, so I don't know what I'm doing incorrectly.  The program itself functions but it's leaking memory at the end.

Do headerGetString() and headerIsSource() increment the reference count?  Looking at the lib/ source, I don't see that obviously standing out.  I only see headerLink() doing and it's not called from many places.

I've modified my local librpm and have it dumping the Header nrefs count.  When I call rpmReadPackageFile(), that reference count becomes 1.  At the end of the program when I call headerFree(), it's 67.  What is the correct way to read a header and not have the reference count grow?  Thanks.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1072
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200214/36d4e5b4/attachment.html>


More information about the Rpm-maint mailing list