diff options
author | jbj <devnull@localhost> | 2002-08-27 20:50:21 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-08-27 20:50:21 +0000 |
commit | 02f9006732201e863d51ce0c170c9c29edaaa364 (patch) | |
tree | 37ce9062a7b856a5eb6d5e74898ef1b335a75669 /rpmdb | |
parent | ab5c7289be52e7798ed0e7ed624dc25d22355641 (diff) | |
download | rpm-02f9006732201e863d51ce0c170c9c29edaaa364.tar.gz rpm-02f9006732201e863d51ce0c170c9c29edaaa364.tar.bz2 rpm-02f9006732201e863d51ce0c170c9c29edaaa364.zip |
- fix: segfault with --checksig, plug memory leak (#72455).
- rpm-4.1 release candidate.
CVS patchset: 5684
CVS date: 2002/08/27 20:50:21
Diffstat (limited to 'rpmdb')
-rw-r--r-- | rpmdb/header.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/rpmdb/header.c b/rpmdb/header.c index c2ad9359e..663c6f4da 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -16,6 +16,9 @@ #include "debug.h" +/*@unchecked@*/ +int _hdr_debug = 1; + /*@-redecl@*/ /* FIX: avoid rpmlib.h, need for debugging. */ /*@observer@*/ const char *const tagName(int tag) /*@*/; /*@=redecl@*/ @@ -98,13 +101,19 @@ static Header headerLink(Header h) /*@modifies h @*/ { - if (h != NULL) - h->nrefs++; /*@-nullret@*/ + if (h == NULL) return NULL; +/*@=nullret@*/ + + h->nrefs++; +/*@-modfilesys@*/ +if (_hdr_debug) +fprintf(stderr, "--> h %p ++ %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__); +/*@=modfilesys@*/ + /*@-refcounttrans @*/ return h; /*@=refcounttrans @*/ -/*@=nullret@*/ } /** \ingroup header @@ -116,8 +125,12 @@ static /*@null@*/ Header headerUnlink(/*@killref@*/ /*@null@*/ Header h) /*@modifies h @*/ { - if (h) - h->nrefs--; + if (h == NULL) return NULL; +/*@-modfilesys@*/ +if (_hdr_debug) +fprintf(stderr, "--> h %p -- %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__); +/*@=modfilesys@*/ + h->nrefs--; return NULL; } |