Re: Proper freeing of memory

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

 



Cory 'G' Watson wrote:

My little rpm app is giving me some frightful valgrind results. My code is pretty much:

rpmReadConfigFiles(NULL, NULL);
rpmdbOpen(NULL, &db, O_RDONLY, 0644);
rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0);
while((h = rpmdbNextIterator(mi)) != NULL) {
    /* grab name, version, and release */
}

rpmdbFreeIterator(mi);
rpmdbClose(db);

Valgrind gives me the following:

definitely lost: 9 bytes  in 1 blocks.
still reachable: 32629 bytes in 1589.


9 bytes is hardly the end of the world. For example, there are leaks in glibc at least that big, and the
popt API forces reallocation of args. Hard to say more w/o line numbers.



Give that example code, is there some mystery *Free* function I'm missing? I'm using 4.0.4 from RedHat 7.2. Perhaps that has something to do with it?


rpm-4.0.4 is already end-of-life, at least for development. The code was pretty squeaky clean, but that was
using mtrace() in glibc, not valgrind, when I last looked for leaks in rpm-4.0.4 several years ago.


73 de Jeff



_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux