- fix: 4 memory leaks eliminated.
authorjbj <devnull@localhost>
Thu, 19 Jul 2001 21:14:05 +0000 (21:14 +0000)
committerjbj <devnull@localhost>
Thu, 19 Jul 2001 21:14:05 +0000 (21:14 +0000)
CVS patchset: 4960
CVS date: 2001/07/19 21:14:05

CHANGES
lib/fsm.c
lib/psm.c
lib/query.c
lib/rpmlib.h
lib/transaction.c
rpmdb/rpmdb.c
rpmio/rpmlog.c
rpmqv.c

diff --git a/CHANGES b/CHANGES
index ace3ed9..71d1247 100644 (file)
--- a/CHANGES
+++ b/CHANGES
        - python: add poptmodule.so bindings.
        - fix: %dev(...) needs to map rdev and mtime from metadata.
        - resurrect --specedit for i18n.
+       - fix: 4 memory leaks eliminated.
 
 4.0 -> 4.0.[12]
        - add doxygen and lclint annotations most everywhere.
index 6f09270..15c4ab0 100644 (file)
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -929,6 +929,7 @@ static int fsmMakeLinks(/*@special@*/ FSM_t fsm)
        if (i == fsm->li->createdPath) continue;
 
        fsm->ix = fsm->li->filex[i];
+       fsm->path = _free(fsm->path);
        rc = fsmStage(fsm, FSM_MAP);
        rc = fsmStage(fsm, FSM_VERIFY);
        if (!rc) continue;
@@ -943,6 +944,7 @@ static int fsmMakeLinks(/*@special@*/ FSM_t fsm)
 
        fsm->li->linksLeft--;
     }
+    fsm->path = _free(fsm->path);
     fsm->opath = _free(fsm->opath);
 
     fsm->ix = iterIndex;
index 9fe34f9..822e8f4 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -916,7 +916,9 @@ static int runScript(PSM_t psm, Header h,
        }
     } else {
        out = fdDup(STDOUT_FILENO);
+#ifdef DYING
        out = fdLink(out, "runScript persist");
+#endif
     }
     if (out == NULL) return 1; /* XXX can't happen */
     
index 2408edf..182c766 100644 (file)
@@ -418,9 +418,9 @@ printNewSpecfile(Spec spec)
            for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
                const char *pkgname;
                h = pkg->header;
-               headerNVR(h, &pkgname, NULL, NULL);
+               (void) headerNVR(h, &pkgname, NULL, NULL);
                if (!strcmp(pkgname, fmt))
-                   break;
+                   /*@innerbreak@*/ break;
            }
            if (pkg == NULL || h == NULL)
                h = spec->packages->header;
index dff6bfa..a34c729 100644 (file)
@@ -641,6 +641,12 @@ typedef /*@abstract@*/ struct rpmdb_s * rpmdb;
 typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
 
 /** \ingroup rpmdb
+ * Tags for which rpmdb indices will be built.
+ */
+/*@only@*/ /*@null@*/ extern int * dbiTags;
+extern int dbiTagsMax;
+
+/** \ingroup rpmdb
  * Open rpm database.
  * @param root         path to top of install tree
  * @retval dbp         address of rpm database
index c17587c..5cd7e10 100644 (file)
@@ -1719,9 +1719,9 @@ int rpmRunTransactions(   rpmTransactionSet ts,
                continue;
            }
 
+#ifdef DYING
            /* Allocate file actions (and initialize to FA_UNKNOWN) */
            fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
-#ifdef DYING
            hdrs[i] = relocateFileList(ts, fi, fi->ap, fi->h, fi->actions);
 #else
            {   Header foo = relocateFileList(ts, fi, fi->ap, fi->h, fi->actions);
index 42a7db3..bc69d45 100644 (file)
@@ -36,8 +36,8 @@ static int _db_filter_dups = 0;
 #define        _DBI_PERMS      0644
 #define        _DBI_MAJOR      -1
 
-static int dbiTagsMax = 0;
-/*@only@*/ /*@null@*/ static int *dbiTags = NULL;
+/*@globstate@*/ /*@null@*/ int * dbiTags = NULL;
+int dbiTagsMax = 0;
 
 /**
  * Return dbi index used for rpm tag.
index 5c6a49e..755a238 100644 (file)
@@ -162,13 +162,12 @@ static void vrpmlog (unsigned code, const char *fmt, va_list ap)
        else
            recs = xrealloc(recs, (nrecs+2) * sizeof(*recs));
        recs[nrecs].code = code;
-       recs[nrecs].message = msg = msgbuf;
-       msgbuf = NULL;
+       recs[nrecs].message = msg = xrealloc(msgbuf, strlen(msgbuf)+1);
+       msgbuf = NULL;          /* XXX don't free at exit. */
        recs[nrecs+1].code = 0;
        recs[nrecs+1].message = NULL;
        ++nrecs;
 
-
        if (_rpmlogCallback) {
            _rpmlogCallback();
            return;     /* XXX Preserve legacy rpmError behavior. */
diff --git a/rpmqv.c b/rpmqv.c
index c689199..439be7e 100755 (executable)
--- a/rpmqv.c
+++ b/rpmqv.c
@@ -1152,6 +1152,8 @@ exit:
     freeNames();
     freeFilesystems();
     urlFreeCache();
+    rpmlogClose();
+    dbiTags = _free(dbiTags);
 
 #ifdef IAM_RPMQV
     qva->qva_queryFormat = _free(qva->qva_queryFormat);