check for memory leaks (almost all leaks are plugged).
authorjbj <devnull@localhost>
Fri, 29 Oct 1999 16:06:01 +0000 (16:06 +0000)
committerjbj <devnull@localhost>
Fri, 29 Oct 1999 16:06:01 +0000 (16:06 +0000)
CVS patchset: 3403
CVS date: 1999/10/29 16:06:01

33 files changed:
CHANGES
build.c
build/files.c
build/names.c
build/pack.c
build/parsePreamble.c
build/rpmbuild.h
lib/cpio.c
lib/depends.c
lib/depends.h
lib/fprint.c
lib/fs.c
lib/hash.c
lib/hash.h
lib/header.c
lib/header.h
lib/macro.c
lib/misc.c
lib/rebuilddb.c
lib/rpmchecksig.c
lib/rpmdb.c
lib/rpmlib.h
lib/rpmrc.c
lib/signature.c
lib/transaction.c
oldrpmdb.c
po/rpm.pot
popt/po/popt.pot
popt/popt.c
popt/poptconfig.c
rpm.c
rpmio/macro.c
tools/rpmgettext.c

diff --git a/CHANGES b/CHANGES
index 759a7c9..e1b1ea1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 3.0.3 -> 3.0.4
        - use compressed filenames on install side.
        - start unifying FD types, CFD_t now gone.
+       - check for memory leaks (almost all leaks are plugged).
 
 3.0.2 -> 3.0.3
        - add --eval to find result of macro expansion.
diff --git a/build.c b/build.c
index 0071b3f..c8742c2 100644 (file)
--- a/build.c
+++ b/build.c
@@ -91,7 +91,6 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
     int test = ba->noBuild;
     FILE *f;
     const char * specfile;
-    int res = 0;
     struct stat statbuf;
     char buf[BUFSIZ];
     Spec spec = NULL;
@@ -102,6 +101,7 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
        const char *specDir;
        const char * tmpSpecFile;
        char * cmd, *s;
+       int res;
 
        specDir = rpmGetPath("%{_specdir}", NULL);
 
@@ -158,13 +158,14 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
 
        s = alloca(strlen(specDir) + strlen(cmd) + 5);
        sprintf(s, "%s/%s", specDir, cmd);
+       res = rename(tmpSpecFile, s);
+       xfree(specDir);
+       xfree(tmpSpecFile);
        
-       if (rename(tmpSpecFile, s)) {
+       if (res) {
            fprintf(stderr, _("Failed to rename %s to %s: %s\n"),
                    tmpSpecFile, s, strerror(errno));
            unlink(tmpSpecFile);
-           xfree(specDir);
-           xfree(tmpSpecFile);
            return 1;
        }
 
@@ -183,8 +184,6 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
        *cmd = '\0';
 
        addMacro(NULL, "_sourcedir", NULL, buf, RMIL_TARBALL);
-       xfree(specDir);
-       xfree(tmpSpecFile);
        specfile = s;
     } else if (arg[0] == '/') {
        specfile = arg;
@@ -236,7 +235,7 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
 
     freeSpec(spec);
     
-    return res;
+    return 0;
 }
 
 int build(const char *arg, struct rpmBuildArguments *ba, const char *passPhrase,
index 197f2ad..83e02af 100644 (file)
@@ -213,19 +213,20 @@ static char *strtokWithQuotes(char *s, char *delim)
 static void timeCheck(int tc, Header h)
 {
     int *mtime;
-    char **file;
+    char **files;
     int count, x, currentTime;
 
-    headerGetEntry(h, RPMTAG_OLDFILENAMES, NULL, (void **) &file, &count);
+    headerGetEntry(h, RPMTAG_OLDFILENAMES, NULL, (void **) &files, &count);
     headerGetEntry(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL);
 
     currentTime = time(NULL);
     
     for (x = 0; x < count; x++) {
        if (currentTime - mtime[x] > tc) {
-           rpmMessage(RPMMESS_WARNING, _("TIMECHECK failure: %s\n"), file[x]);
+           rpmMessage(RPMMESS_WARNING, _("TIMECHECK failure: %s\n"), files[x]);
        }
     }
+    FREE(files);
 }
 
 typedef struct VFA {
@@ -591,11 +592,14 @@ static int parseForRegexLang(const char *fileName, /*@out@*/char **lang)
 
     if (! initialized) {
        const char *patt = rpmExpand("%{_langpatt}", NULL);
+       int rc = 0;
        if (!(patt && *patt != '%'))
-           return 1;
-       if (regcomp(&compiledPatt, patt, REG_EXTENDED))
-           return -1;
+           rc = 1;
+       else if (regcomp(&compiledPatt, patt, REG_EXTENDED))
+           rc = -1;
        xfree(patt);
+       if (rc)
+           return rc;
        hasRegex = 1;
        initialized = 1;
     }
@@ -1170,11 +1174,12 @@ static int processPackageFiles(Spec spec, Package pkg,
        ffn = rpmGetPath("%{_builddir}/",
            (spec->buildSubdir ? spec->buildSubdir : "") ,
            "/", pkg->fileFile, NULL);
+       f = fopen(ffn, "r");
+       xfree(ffn);
 
-       if ((f = fopen(ffn, "r")) == NULL) {
+       if (f == NULL) {
            rpmError(RPMERR_BADFILENAME,
                     _("Could not open %%files file: %s"), pkg->fileFile);
-           FREE(ffn);
            return RPMERR_BADFILENAME;
        }
        while (fgets(buf, sizeof(buf), f)) {
@@ -1186,12 +1191,11 @@ static int processPackageFiles(Spec spec, Package pkg,
            appendStringBuf(pkg->fileList, buf);
        }
        fclose(f);
-       FREE(ffn);
     }
     
     /* Init the file list structure */
     
-    /* XXX spec->buildRoot == NULL, then strdup("") is returned */
+    /* XXX spec->buildRoot == NULL, then xstrdup("") is returned */
     fl.buildRoot = rpmGetPath(spec->buildRoot, NULL);
 
     if (headerGetEntry(pkg->header, RPMTAG_DEFAULTPREFIX,
@@ -1354,8 +1358,11 @@ void initSourceHeader(Spec spec)
 
     spec->sourceHeader = headerNew();
     /* Only specific tags are added to the source package header */
-    hi = headerInitIterator(spec->packages->header);
-    while (headerNextIterator(hi, &tag, &type, &ptr, &count)) {
+    for (hi = headerInitIterator(spec->packages->header);
+       headerNextIterator(hi, &tag, &type, &ptr, &count);
+       ptr = ((type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE)
+           ? xfree(ptr), NULL : NULL))
+    {
        switch (tag) {
          case RPMTAG_NAME:
          case RPMTAG_VERSION:
@@ -1381,18 +1388,16 @@ void initSourceHeader(Spec spec)
            /* do not copy */
            break;
        }
-       if (type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE) {
-           FREE(ptr);
-       }
     }
     headerFreeIterator(hi);
 
     /* Add the build restrictions */
-    hi = headerInitIterator(spec->buildRestrictions);
-    while (headerNextIterator(hi, &tag, &type, &ptr, &count)) {
+    for (hi = headerInitIterator(spec->buildRestrictions);
+       headerNextIterator(hi, &tag, &type, &ptr, &count);
+       ptr = ((type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE)
+           ? xfree(ptr), NULL : NULL))
+    {
        headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
-       if (type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE)
-           FREE(ptr);
     }
     headerFreeIterator(hi);
 
index 806bb61..60ef5b6 100644 (file)
@@ -5,13 +5,22 @@
 #include "rpmbuild.h"
 
 static uid_t uids[1024];
-/*@owned@*/ /*@null@*/ static char *unames[1024];
+/*@owned@*/ /*@null@*/ static const char *unames[1024];
 static int uid_used = 0;
 
 static gid_t gids[1024];
-/*@owned@*/ /*@null@*/ static char *gnames[1024];
+/*@owned@*/ /*@null@*/ static const char *gnames[1024];
 static int gid_used = 0;
     
+void freeNames(void)
+{
+    int x;
+    for (x = 0; x < uid_used; x++)
+       xfree(unames[x]);
+    for (x = 0; x < gid_used; x++)
+       xfree(gnames[x]);
+}
+
 /*
  * getUname() takes a uid, gets the username, and creates an entry in the
  * table to hold a string containing the user name.
index d8db320..143cd77 100644 (file)
@@ -69,6 +69,7 @@ int packageSources(Spec spec)
 
        rc = writeRPM(spec->sourceHeader, fn, RPMLEAD_SOURCE,
                csa, spec->passPhrase, &(spec->cookie));
+       free(csa->cpioFdIn);
        xfree(fn);
     }
     return rc;
@@ -126,6 +127,7 @@ int packageBinaries(Spec spec)
            char *binRpm, *binDir;
            binRpm = headerSprintf(pkg->header, binFormat, rpmTagTable,
                               rpmHeaderFormats, &errorString);
+           xfree(binFormat);
            if (binRpm == NULL) {
                headerGetEntry(pkg->header, RPMTAG_NAME, NULL,
                           (void **)&name, NULL);
@@ -164,6 +166,7 @@ int packageBinaries(Spec spec)
 
        rc = writeRPM(pkg->header, fn, RPMLEAD_BINARY,
                    csa, spec->passPhrase, NULL);
+       free(csa->cpioFdIn);
        xfree(fn);
        if (rc)
            return rc;
index 8cffc5a..ee1eeee 100644 (file)
@@ -185,15 +185,16 @@ static int checkForDuplicates(Header h, char *name)
 #if 0  /* XXX harmless, but headerInitIterator() does this anyways */
     headerSort(h);
 #endif
-    hi = headerInitIterator(h);
-    lastTag = 0;
-    while (headerNextIterator(hi, &tag, NULL, NULL, NULL)) {
-       if (tag == lastTag) {
-           rpmError(RPMERR_BADSPEC, _("Duplicate %s entries in package: %s"),
+
+    for (hi = headerInitIterator(h), lastTag = 0;
+       headerNextIterator(hi, &tag, NULL, NULL, NULL);
+       lastTag = tag)
+    {
+       if (tag != lastTag)
+           continue;
+       rpmError(RPMERR_BADSPEC, _("Duplicate %s entries in package: %s"),
                     tagName(tag), name);
-           res = 1;
-       }
-       lastTag = tag;
+       res = 1;
     }
     headerFreeIterator(hi);
 
index 9284fa9..a874e64 100644 (file)
@@ -69,6 +69,7 @@ extern "C" {
 
 /* from build/names.h */
 
+void freeNames(void);
 /*@observer@*/ const char *getUname(uid_t uid);
 /*@observer@*/ const char *getUnameS(const char *uname);
 /*@observer@*/ const char *getGname(gid_t gid);
index ccde5cf..704b085 100644 (file)
@@ -175,15 +175,11 @@ static int getNextHeader(FD_t cfd, /*@out@*/ struct cpioHeader * chPtr)
 
     GET_NUM_FIELD(physHeader.devMajor, major);
     GET_NUM_FIELD(physHeader.devMinor, minor);
-#ifndef __LCLINT__
-    chPtr->dev = makedev(major, minor);
-#endif
+    chPtr->dev = /*@-shiftsigned@*/ makedev(major, minor) /*@=shiftsigned@*/ ;
 
     GET_NUM_FIELD(physHeader.rdevMajor, major);
     GET_NUM_FIELD(physHeader.rdevMinor, minor);
-#ifndef __LCLINT__
-    chPtr->rdev = makedev(major, minor);
-#endif
+    chPtr->rdev = /*@-shiftsigned@*/ makedev(major, minor) /*@=shiftsigned@*/ ;
 
     GET_NUM_FIELD(physHeader.namesize, nameSize);
 
@@ -454,7 +450,7 @@ static void freeLink( /*@only@*/ struct hardLink * li)
 
     for (i = 0; i < li->nlink; i++) {
        if (li->files[i] == NULL) continue;
-       free((void *)li->files[i]);
+       /*@-unqualifiedtrans@*/ free(li->files[i]) /*@=unqualifiedtrans@*/ ;
        li->files[i] = NULL;
     }
     free(li->files);
@@ -483,7 +479,7 @@ static int createLinks(struct hardLink * li, /*@out@*/const char ** failedFile)
            return CPIOERR_LINK_FAILED;
        }
 
-       free((void *)li->files[i]);
+       /*@-unqualifiedtrans@*/ free(li->files[i]) /*@=unqualifiedtrans@*/ ;
        li->files[i] = NULL;
        li->linksLeft--;
     }
@@ -728,10 +724,10 @@ static int writeFile(FD_t cfd, struct stat sb, struct cpioFileMapping * map,
     SET_NUM_FIELD(hdr.mtime, sb.st_mtime, buf);
     SET_NUM_FIELD(hdr.filesize, sb.st_size, buf);
 
-    num = major(sb.st_dev); SET_NUM_FIELD(hdr.devMajor, num, buf);
-    num = minor(sb.st_dev); SET_NUM_FIELD(hdr.devMinor, num, buf);
-    num = major(sb.st_rdev); SET_NUM_FIELD(hdr.rdevMajor, num, buf);
-    num = minor(sb.st_rdev); SET_NUM_FIELD(hdr.rdevMinor, num, buf);
+    num = major((unsigned)sb.st_dev); SET_NUM_FIELD(hdr.devMajor, num, buf);
+    num = minor((unsigned)sb.st_dev); SET_NUM_FIELD(hdr.devMinor, num, buf);
+    num = major((unsigned)sb.st_rdev); SET_NUM_FIELD(hdr.rdevMajor, num, buf);
+    num = minor((unsigned)sb.st_rdev); SET_NUM_FIELD(hdr.rdevMinor, num, buf);
 
     num = strlen(map->archivePath) + 1; SET_NUM_FIELD(hdr.namesize, num, buf);
     memcpy(hdr.checksum, "00000000", 8);
index 5be3a4e..1c932e1 100644 (file)
@@ -567,7 +567,7 @@ rpmTransactionSet rpmtransCreateSet(rpmdb db, const char * root)
 
     rpmdep->orderAlloced = 5;
     rpmdep->orderCount = 0;
-    rpmdep->order = xcalloc(rpmdep->orderAlloced, sizeof(*rpmdep->order)); /* XXX memory leak */
+    rpmdep->order = xcalloc(rpmdep->orderAlloced, sizeof(*rpmdep->order));
 
     return rpmdep;
 }
@@ -710,6 +710,7 @@ void rpmtransFree(rpmTransactionSet rpmdep)
     alFree(&rpmdep->availablePackages);
     free(rpmdep->removedPackages);
     xfree(rpmdep->root);
+    free(rpmdep->order);
 
     free(rpmdep);
 }
@@ -1314,7 +1315,7 @@ int rpmdepOrder(rpmTransactionSet rpmdep)
     qsort(orderList, rpmdep->addedPackages.size, sizeof(*orderList),
          orderListIndexCmp);
 
-    newOrder = xmalloc(sizeof(*newOrder) * rpmdep->orderCount); /* XXX memory leak */
+    newOrder = xmalloc(sizeof(*newOrder) * rpmdep->orderCount);
     for (i = 0, newOrderCount = 0; i < orderingCount; i++) {
        key.alIndex = ordering[i];
        needle = bsearch(&key, orderList, rpmdep->addedPackages.size,
index b89aa38..e24418b 100644 (file)
@@ -33,9 +33,9 @@ struct fileIndexEntry {
 } ;
 
 struct dirInfo {
-    /*@owned@*/ char * dirName;                /* strdup'd */
+    /*@owned@*/ char * dirName;                        /* xstrdup'd */
     int dirNum;
-    /*@owned@*/ struct fileIndexEntry * files; /* malloc'd */
+    /*@owned@*/ struct fileIndexEntry * files; /* xmalloc'd */
     int numFiles;
 } ;
 
@@ -49,7 +49,7 @@ struct availableList {
     struct availableIndex index;
     int size, alloced;
     int numDirs;
-    struct dirInfo * dirs;             /* malloc'd */
+    struct dirInfo * dirs;                     /* xmalloc'd */
 };
 
 struct transactionElement {
index 94f5974..41d91a7 100644 (file)
@@ -3,16 +3,20 @@
 #include <rpmlib.h>
 #include "fprint.h"
 
-fingerPrintCache fpCacheCreate(int sizeHint) {
+fingerPrintCache fpCacheCreate(int sizeHint)
+{
     fingerPrintCache fpc;
 
     fpc = xmalloc(sizeof(*fpc));
-    fpc->ht = htCreate(sizeHint * 2, sizeof(char *), hashFunctionString,
+    fpc->ht = htCreate(sizeHint * 2, sizeof(char *), 1, hashFunctionString,
                       hashEqualityString);
     return fpc;
 }
 
-void fpCacheFree(fingerPrintCache cache) {
+void fpCacheFree(fingerPrintCache cache)
+{
+    htFree(cache->ht);
+    free(cache);
 }
 
 static const struct fprintCacheEntry_s * cacheContainsDirectory(
@@ -35,7 +39,6 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
     struct stat sb;
     char * buf;
     const struct fprintCacheEntry_s * cacheHit;
-    struct fprintCacheEntry_s * newEntry;
 
     /* assert(*dirName == '/' || !scareMemory); */
 
@@ -72,15 +75,18 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
        if ((cacheHit = cacheContainsDirectory(cache, *buf ? buf : "/"))) {
            fp.entry = cacheHit;
        } else if (!stat(*buf ? buf : "/", &sb)) {
-           newEntry = xmalloc(sizeof(*fp.entry));
+           size_t nb = sizeof(*fp.entry) + (*buf ? strlen(buf) : 1) + 1;
+           char * dn = xmalloc(nb);
+           struct fprintCacheEntry_s * newEntry = (void *)dn;
+           dn += sizeof(*newEntry);
+           strcpy(dn, (*buf ? buf : "/"));
            newEntry->ino = sb.st_ino;
            newEntry->dev = sb.st_dev;
            newEntry->isFake = 0;
-           newEntry->dirName = xstrdup(*buf ? buf : "/");          
+           newEntry->dirName = dn;
            fp.entry = newEntry;
 
-           /* XXX FIXME: memory leak */
-           htAddEntry(cache->ht, xstrdup(*buf ? buf : "/"), fp.entry);
+           htAddEntry(cache->ht, dn, fp.entry);
        }
 
         if (fp.entry) {
@@ -112,7 +118,8 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName,
 }
 
 fingerPrint fpLookup(fingerPrintCache cache, const char * fullName, 
-                    int scareMemory) {
+                    int scareMemory)
+{
     char *dn = strcpy(alloca(strlen(fullName)+1), fullName);
     char *bn = strrchr(dn, '/');
 
@@ -152,7 +159,8 @@ int fpEqual(const void * key1, const void * key2)
 
 void fpLookupList(fingerPrintCache cache, const char ** dirNames, 
                  const char ** baseNames, const int * dirIndexes, 
-                 int fileCount, fingerPrint * fpList) {
+                 int fileCount, fingerPrint * fpList)
+{
     int i;
 
     for (i = 0; i < fileCount; i++) {
@@ -169,7 +177,8 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
     }
 }
 
-void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList) {
+void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
+{
     int fileCount;
     const char ** baseNames, ** dirNames;
     int_32 * dirIndexes;
index e92d21b..02e6012 100644 (file)
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -12,6 +12,22 @@ struct fsinfo {
 /*@only@*/ /*@null@*/ static const char ** fsnames = NULL;
 static int numFilesystems = 0;
 
+void freeFilesystems(void)
+{
+    if (filesystems) {
+       int i;
+       for (i = 0; i < numFilesystems; i++)
+           xfree(filesystems[i].mntPoint);
+       free(filesystems);
+       filesystems = NULL;
+    }
+    if (fsnames) {
+       free(fsnames);
+       fsnames = NULL;
+    }
+    numFilesystems = 0;
+}
+
 #if HAVE_MNTCTL
 
 /* modeled after sample code from Till Bubeck */
@@ -75,12 +91,8 @@ static int getFilesystemList(void)
            rpmError(RPMERR_STAT, _("failed to stat %s: %s"), fsnames[i],
                        strerror(errno));
 
-           free(filesystems);
-           filesystems = NULL;
-           for (i = 0; i < num; i++)
-               free(fsnames[i]);
-           free(fsnames);
-           fsnames = NULL;
+           freeFileSystems();
+           return 1;
        }
        
        filesystems[i].dev = sb.st_dev;
@@ -94,11 +106,12 @@ static int getFilesystemList(void)
 
     return 0;
 }
-#else 
+
+#else  /* HAVE_MNTCTL */
+
 static int getFilesystemList(void)
 {
     int numAlloced = 10;
-    int num = 0;
     struct stat sb;
     int i;
     char * mntdir;
@@ -126,6 +139,7 @@ static int getFilesystemList(void)
 
     filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems));     /* XXX memory leak */
 
+    numFilesystems = 0;
     while (1) {
 #      if GETMNTENT_ONE
            /* this is Linux */
@@ -146,23 +160,19 @@ static int getFilesystemList(void)
            rpmError(RPMERR_STAT, "failed to stat %s: %s", mntdir,
                        strerror(errno));
 
-           for (i = 0; i < num; i++)
-               xfree(filesystems[i].mntPoint);
-           free(filesystems);
-
-           filesystems = NULL;
+           freeFilesystems();
            return 1;
        }
 
-       if (num == numAlloced) {
+       numFilesystems++;
+       if ((numFilesystems + 1) == numAlloced) {
            numAlloced += 10;
            filesystems = xrealloc(filesystems, 
                                  sizeof(*filesystems) * (numAlloced + 1));
        }
 
-       filesystems[num].dev = sb.st_dev;
-       filesystems[num].mntPoint = xstrdup(mntdir);    /* XXX memory leak */
-       num++;
+       filesystems[numFilesystems-1].dev = sb.st_dev;
+       filesystems[numFilesystems-1].mntPoint = xstrdup(mntdir);
     }
 
 #   if GETMNTENT_ONE || GETMNTENT_TWO
@@ -171,19 +181,17 @@ static int getFilesystemList(void)
        free(mounts);
 #   endif
 
-    filesystems[num].dev = 0;
-    filesystems[num].mntPoint = NULL;
+    filesystems[numFilesystems].dev = 0;
+    filesystems[numFilesystems].mntPoint = NULL;
 
-    fsnames = xcalloc((num + 1), sizeof(*fsnames));    /* XXX memory leak */
-    for (i = 0; i < num; i++)
+    fsnames = xcalloc((numFilesystems + 1), sizeof(*fsnames));
+    for (i = 0; i < numFilesystems; i++)
        fsnames[i] = filesystems[i].mntPoint;
-    fsnames[num] = NULL;
-
-    numFilesystems = num;
+    fsnames[numFilesystems] = NULL;
 
     return 0; 
 }
-#endif
+#endif /* HAVE_MNTCTL */
 
 int rpmGetFilesystemList(const char *** listptr, int * num)
 {
@@ -217,7 +225,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
 
     usages = xcalloc(numFilesystems, sizeof(usages));
 
-    sourceDir = rpmGetPath("", "/%{_sourcedir}", NULL);
+    sourceDir = rpmGetPath("%{_sourcedir}", NULL);
 
     maxLen = strlen(sourceDir);
     for (i = 0; i < numFiles; i++) {
@@ -252,6 +260,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
                if (errno != ENOENT) {
                    rpmError(RPMERR_STAT, _("failed to stat %s: %s"), buf,
                                strerror(errno));
+                   xfree(sourceDir);
                    free(usages);
                    return 1;
                }
@@ -272,6 +281,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
                if (j == numFilesystems) {
                    rpmError(RPMERR_BADDEV, 
                                _("file %s is on an unknown device"), buf);
+                   xfree(sourceDir);
                    free(usages);
                    return 1;
                }
index a8dd869..3b1c980 100644 (file)
@@ -13,6 +13,7 @@ struct hashBucket {
 struct hashTable_s {
     int numBuckets;
     int keySize;
+    int freeData;
     struct hashBucket ** buckets;
     hashFunctionType fn;
     hashEqualityType eq;
@@ -56,7 +57,7 @@ unsigned int hashFunctionString(const void * string)
     return ((((unsigned)len) << 16) + (((unsigned)sum) << 8) + xorValue);
 }
 
-hashTable htCreate(int numBuckets, int keySize, hashFunctionType fn,
+hashTable htCreate(int numBuckets, int keySize, int freeData, hashFunctionType fn,
                   hashEqualityType eq)
 {
     hashTable ht;
@@ -65,6 +66,7 @@ hashTable htCreate(int numBuckets, int keySize, hashFunctionType fn,
     ht->numBuckets = numBuckets;
     ht->buckets = xcalloc(numBuckets, sizeof(*ht->buckets));
     ht->keySize = keySize;
+    ht->freeData = freeData;
     ht->fn = fn;
     ht->eq = eq;
 
@@ -103,15 +105,18 @@ void htAddEntry(hashTable ht, const void * key, const void * data)
 
 void htFree(hashTable ht)
 {
-    int i;
     struct hashBucket * b, * n;
+    int i;
 
     for (i = 0; i < ht->numBuckets; i++) {
        b = ht->buckets[i];
        if (ht->keySize && b) xfree(b->key);
        while (b) {
            n = b->next;
-           if (b->data) xfree(b->data);
+           if (b->data) {
+               if (ht->freeData && *b->data) xfree(*b->data);
+               xfree(b->data);
+           }
            free(b);
            b = n;
        }
index 9d58f21..b5e0af2 100644 (file)
@@ -15,8 +15,8 @@ int hashEqualityString(const void * key1, const void * key2);
 
 /* if keySize > 0, the key is duplicated within the table (which costs
    memory, but may be usefull anyway */
-hashTable htCreate(int numBuckets, int keySize, hashFunctionType fn,
-                  hashEqualityType eq); 
+hashTable htCreate(int numBuckets, int keySize, int freeData,
+               hashFunctionType fn, hashEqualityType eq); 
 void htAddEntry(hashTable ht, const void * key, const void * data);
 void htFree( /*@only@*/ hashTable ht);
 /* returns 0 on success, 1 if the item is not found. tableKey may be NULL */
index f43e943..adfb148 100644 (file)
@@ -949,8 +949,8 @@ headerFindI18NString(Header h, struct indexEntry *entry)
     return entry->data;
 }
 
-static int intGetEntry(Header h, int_32 tag, /*@out@*/int_32 *type, /*@out@*/void **p, /*@out@*/int_32 *c,
-                      int minMem)
+static int intGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
+       /*@out@*/ void **p, /*@out@*/ int_32 *c, int minMem)
 {
     struct indexEntry * entry;
     char * chptr;
index e3fdd62..d11a43a 100644 (file)
@@ -139,6 +139,7 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
    entry is present). */
 int headerGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
        /*@out@*/ void **p, /*@out@*/int_32 *c);
+
 /* This gets an entry, and uses as little extra RAM as possible to represent
    it (this is only an issue for RPM_STRING_ARRAY_TYPE. */
 int headerGetEntryMinMemory(Header h, int_32 tag, int_32 *type,
index 24d4b5d..2e65054 100644 (file)
@@ -1399,7 +1399,7 @@ rpmExpand(const char *arg, ...)
     }
     va_end(ap);
     expandMacros(NULL, NULL, buf, sizeof(buf));
-    return xstrdup(buf);       /* XXX build memory leaks */
+    return xstrdup(buf);
 }
 
 int
index d94ea9c..7ea8cd9 100644 (file)
@@ -406,10 +406,10 @@ char * currentDirectory(void) {
 }
 
 void compressFilelist(Header h) {
-    char ** files;
-    char ** dirList;
+    const char ** files;
+    const char ** dirList;
     int * compDirList;
-    char ** baseNames;
+    const char ** baseNames;
     int fileCount;
     int i;
     char * tail;
@@ -427,7 +427,8 @@ void compressFilelist(Header h) {
 
     if (files[0][0] != '/') {
        /* HACK. Source RPM, so just do things differently */
-       return ;
+       free(files);
+       return;
     }
 
     dirList = alloca(sizeof(*dirList) * fileCount);    /* worst case */
@@ -435,14 +436,14 @@ void compressFilelist(Header h) {
     compDirList = alloca(sizeof(*compDirList) * fileCount); 
 
     for (i = 0; i < fileCount; i++) {
-       tail = strrchr(files[i], '/') + 1;
+       char *tail = strrchr(files[i], '/') + 1;
        
        if (lastDir < 0 || (lastLen != (tail - files[i])) ||
                strncmp(dirList[lastDir], files[i], tail - files[i])) {
-           lastDir++;
-           dirList[lastDir] = alloca(tail - files[i] + 1);
-           memcpy(dirList[lastDir], files[i], tail - files[i]);
-           dirList[lastDir][tail - files[i]] = '\0';
+           char *s = alloca(tail - files[i] + 1);
+           memcpy(s, files[i], tail - files[i]);
+           s[tail - files[i]] = '\0';
+           dirList[++lastDir] = s;
            lastLen = tail - files[i];
        } 
 
@@ -468,10 +469,10 @@ static void doBuildFileList(Header h, /*@out@*/ char *** fileListPtr,
                            /*@out@*/ int * fileCountPtr, int baseNameTag,
                            int dirListTag, int dirIndexesTag) {
     int * dirList;
-    char ** dirs;
-    char ** tails;
+    const char ** dirs;
+    const char ** tails;
     int count;
-    char ** fileList;
+    const char ** fileList;
     int size;
     char * data;
     int i;
@@ -503,6 +504,8 @@ static void doBuildFileList(Header h, /*@out@*/ char *** fileListPtr,
 
     *fileListPtr = fileList;
     *fileCountPtr = count;
+    free(tails);
+    free(dirs);
 }
 
 void buildFileList(Header h, char *** fileListPtr, int * fileCountPtr) {
index fdeabdc..edcd075 100644 (file)
@@ -20,9 +20,10 @@ int rpmdbRebuild(const char * rootdir)
     rpmMessage(RPMMESS_DEBUG, _("rebuilding database in rootdir %s\n"), rootdir);
 
     dbpath = rpmGetPath("%{_dbpath}", NULL);
-    if (!dbpath || dbpath[0] == '%') {
+    if (!(dbpath && dbpath[0] != '%')) {
        rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
-       return 1;
+       rc = 1;
+       goto exit;
     }
 
     sprintf(tfn, "rebuilddb.%d", (int) getpid());
index 598cbc0..2612c4f 100644 (file)
@@ -276,8 +276,11 @@ int rpmCheckSig(int flags, const char **argv)
        untrustedKeys[0] = '\0';
        sprintf(buffer, "%s:%c", rpm, (rpmIsVerbose() ? '\n' : ' ') );
 
-       sigIter = headerInitIterator(sig);
-       while (headerNextIterator(sigIter, &tag, &type, &ptr, &count)) {
+       for (sigIter = headerInitIterator(sig);
+           headerNextIterator(sigIter, &tag, &type, &ptr, &count);
+           ptr = ((type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE)
+               ? xfree(ptr), NULL : NULL))
+       {
            switch (tag) {
            case RPMSIGTAG_PGP5:        /* XXX legacy */
            case RPMSIGTAG_PGP:
index 07752df..7782410 100644 (file)
@@ -61,16 +61,13 @@ static void unblockSignals(void)
 
 int rpmdbOpenForTraversal(const char * prefix, rpmdb * rpmdbp)
 {
-    const char * dbpath;
+    const char * dbpath = rpmGetPath("%{_dbpath}", NULL);
     int rc = 0;
 
-    dbpath = rpmGetPath("%{_dbpath}", NULL);
-    if (dbpath == NULL || dbpath[0] == '%') {
+    if (!(dbpath && dbpath[0] != '%')) {
        rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
-       return 1;
-    }
-
-    if (openDatabase(prefix, dbpath, rpmdbp, O_RDONLY, 0644, 
+       rc = 1;
+    } else if (openDatabase(prefix, dbpath, rpmdbp, O_RDONLY, 0644, 
                     RPMDB_FLAG_MINIMAL)) {
        rc = 1;
     }
@@ -80,33 +77,29 @@ int rpmdbOpenForTraversal(const char * prefix, rpmdb * rpmdbp)
 
 int rpmdbOpen (const char * prefix, rpmdb *rpmdbp, int mode, int perms)
 {
-    const char * dbpath;
+    const char * dbpath = rpmGetPath("%{_dbpath}", NULL);
     int rc;
 
-    dbpath = rpmGetPath("%{_dbpath}", NULL);
-    if (dbpath == NULL || dbpath[0] == '%') {
+    if (!(dbpath && dbpath[0] != '%')) {
        rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
-       return 1;
-    }
-
-    rc = openDatabase(prefix, dbpath, rpmdbp, mode, perms, 0);
+       rc = 1;
+    } else
+       rc = openDatabase(prefix, dbpath, rpmdbp, mode, perms, 0);
     xfree(dbpath);
     return rc;
 }
 
 int rpmdbInit (const char * prefix, int perms)
 {
+    const char * dbpath = rpmGetPath("%{_dbpath}", NULL);
     rpmdb db;
-    const char * dbpath;
     int rc;
 
-    dbpath = rpmGetPath("%{_dbpath}", NULL);
-    if (dbpath == NULL || dbpath[0] == '%') {
+    if (!(dbpath && dbpath[0] != '%')) {
        rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
-       return 1;
-    }
-
-    rc = openDatabase(prefix, dbpath, &db, O_CREAT | O_RDWR, perms, 
+       rc = 1;
+    } else
+       rc = openDatabase(prefix, dbpath, &db, O_CREAT | O_RDWR, perms, 
                        RPMDB_FLAG_JUSTCHECK);
     xfree(dbpath);
     return rc;
index b3cb322..bf6ffb3 100644 (file)
@@ -265,7 +265,7 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
 
 #define        xfree(_p)       free((void *)_p)
 
-char * rpmGetVar(int var);
+const char * rpmGetVar(int var);
 void rpmSetVar(int var, const char *val);
 
 /** rpmrc.c **/
@@ -650,6 +650,7 @@ void rpmFreeSignature(Header h);
 int rpmVerifySignature(const char *file, int_32 sigTag, void *sig, int count,
                       char *result);
 
+void freeFilesystems(void);
 int rpmGetFilesystemList( /*@out@*/ const char *** listptr, /*@out@*/int * num);
 int rpmGetFilesystemUsage(const char ** filelist, int_32 * fssizes,
        int numFiles, /*@out@*/ uint_32 ** usagesPtr, int flags);
index 0f9c302..bdea7ca 100644 (file)
@@ -38,14 +38,14 @@ struct machEquivTable {
 };
 
 struct rpmvarValue {
-    char * value;
+    const char * value;
     /* eventually, this arch will be replaced with a generic condition */
-    char * arch;
+    const char * arch;
     struct rpmvarValue * next;
 };
 
 struct rpmOption {
-    char * name;
+    const char * name;
     int var;
     int archSpecific, required, macroize, localize;
     struct rpmOptionValue * value;
@@ -104,45 +104,10 @@ static int currTables[2] = { RPM_MACHTABLE_INSTOS, RPM_MACHTABLE_INSTARCH };
 static struct rpmvarValue values[RPMVAR_NUM];
 
 /* prototypes */
-static void defaultMachine(/*@out@*/ const char ** arch, /*@out@*/ const char ** os);
 static int doReadRC(FD_t fd, const char * filename);
-static int optionCompare(const void * a, const void * b);
-static int addCanon(struct canonEntry **table, int *tableLen, char *line,
-                       const char *fn, int lineNum);
-static int addDefault(struct defaultEntry **table, int *tableLen, char *line,
-                       const char *fn, int lineNum);
-static void freeRpmVar(struct rpmvarValue * orig);
 static void rpmSetVarArch(int var, const char * val, const char * arch);
-static struct canonEntry *lookupInCanonTable(char *name,
-                                          struct canonEntry *table,
-                                          int tableLen);
-static const char *lookupInDefaultTable(const char *name,
-                                 struct defaultEntry *table,
-                                 int tableLen);
-
-static void setVarDefault(int var, const char *macroname, const char *val, const char *body);
-static void setPathDefault(int var, const char *macroname, const char *subdir);
-static void setDefaults(void);
-
 static void rebuildCompatTables(int type, const char *name);
 
-/* compatiblity tables */
-static int machCompatCacheAdd(char * name, const char * fn, int linenum,
-                               struct machCache * cache);
-static struct machCacheEntry * machCacheFindEntry(struct machCache * cache,
-                                                 const char * key);
-static struct machEquivInfo * machEquivSearch(
-               struct machEquivTable * table, const char * name);
-static void machAddEquiv(struct machEquivTable * table, const char * name,
-                          int distance);
-static void machCacheEntryVisit(struct machCache * cache,
-                                 struct machEquivTable * table,
-                                 const char * name,
-                                 int distance);
-static void machFindEquivs(struct machCache * cache,
-                            struct machEquivTable * table,
-                            const char * key);
-
 static int optionCompare(const void * a, const void * b) {
     return strcasecmp(((struct rpmOption *) a)->name,
                      ((struct rpmOption *) b)->name);
@@ -259,9 +224,9 @@ static void machAddEquiv(struct machEquivTable * table, const char * name,
            table->list = xrealloc(table->list, (table->count + 1)
                                    * sizeof(*table->list));
        else
-           table->list = xmalloc(sizeof(*table->list)); /* XXX memory leak */
+           table->list = xmalloc(sizeof(*table->list));
 
-       table->list[table->count].name = xstrdup(name); /* XXX memory leak */
+       table->list[table->count].name = xstrdup(name);
        table->list[table->count++].score = distance;
     }
 }
@@ -297,7 +262,13 @@ static void machFindEquivs(struct machCache * cache,
     for (i = 0; i < cache->size; i++)
        cache->cache[i].visited = 0;
 
+    while (table->count > 0) {
+       xfree(table->list[--table->count].name);
+       table->list[table->count].name = NULL;
+    }
     table->count = 0;
+    if (table->list) xfree(table->list);
+    table->list = NULL;
 
     /* We have a general graph built using strings instead of pointers.
        Yuck. We have to start at a point at traverse it, remembering how
@@ -588,15 +559,21 @@ int rpmReadRC(const char * rcfiles)
 
     rpmSetMachine(NULL, NULL); /* XXX WTFO? Why bother? */
 
-    if ((r = rpmGetVar(RPMVAR_MACROFILES)) != NULL)
-       initMacros(NULL, r);
+    {  const char *macrofiles;
+       if ((macrofiles = rpmGetVar(RPMVAR_MACROFILES)) != NULL) {
+           macrofiles = strdup(macrofiles);
+           initMacros(NULL, macrofiles);
+           xfree(macrofiles);
+       }
+    }
 
     return rc;
 }
 
 static int doReadRC(FD_t fd, const char * filename)
 {
-    char *s, *se, *next;
+    const char *s;
+    char *se, *next;
     int linenum = 0;
     struct rpmOption searchOption, * option;
     int rc;
@@ -616,7 +593,7 @@ static int doReadRC(FD_t fd, const char * filename)
     while (*next) {
        linenum++;
 
-       se = s = next;
+       s = se = next;
        while (*se && *se != '\n') se++;
        if (*se) *se++ = '\0';
        next = se;
@@ -626,7 +603,7 @@ static int doReadRC(FD_t fd, const char * filename)
        /* we used to allow comments to begin anywhere, but not anymore */
        if (*s == '#' || *s == '\0') continue;
 
-       se = s;
+       se = (char *)s;
        while (*se && !isspace(*se) && *se != ':') se++;
 
        if (isspace(*se)) {
@@ -761,7 +738,7 @@ static int doReadRC(FD_t fd, const char * filename)
            }
 
            if (i < RPM_MACHTABLE_COUNT) {
-               char *rest = s + strlen(tables[i].key);
+               const char *rest = s + strlen(tables[i].key);
                if (*rest == '_') rest++;
 
                if (!strcmp(rest, "compat")) {
@@ -966,7 +943,7 @@ static void defaultMachine(const char ** arch, const char ** os) {
     if (os) *os = un.sysname;
 }
 
-static char * rpmGetVarArch(int var, char * arch) {
+static const char * rpmGetVarArch(int var, char * arch) {
     struct rpmvarValue * next;
 
     if (!arch) arch = current[ARCH];
@@ -985,7 +962,7 @@ static char * rpmGetVarArch(int var, char * arch) {
     return next ? next->value : NULL;
 }
 
-char *rpmGetVar(int var)
+const char *rpmGetVar(int var)
 {
     return rpmGetVarArch(var, NULL);
 }
@@ -997,11 +974,11 @@ static void freeRpmVar(struct rpmvarValue * orig) {
     while (var) {
        next = var->next;
        if (var->arch) {
-           free(var->arch);
+           xfree(var->arch);
            var->arch = NULL;
        }
        if (var->value) {
-           free(var->value);
+           xfree(var->value);
            var->value = NULL;
        }
 
@@ -1032,16 +1009,18 @@ static void rpmSetVarArch(int var, const char * val, const char * arch) {
        }
 
        if (next->arch && arch && !strcmp(next->arch, arch)) {
-           if (next->value) free(next->value);
-           if (next->arch) free(next->arch);
+           if (next->value) xfree(next->value);
+           if (next->arch) xfree(next->arch);
        } else if (next->arch || arch) {
            next->next = xmalloc(sizeof(*next->next));
            next = next->next;
+           next->value = NULL;
+           next->arch = NULL;
            next->next = NULL;
        }
     }
 
-    next->value = xstrdup(val);
+    next->value = xstrdup(val);                /* XXX memory leak, hard to plug */
     next->arch = (arch ? xstrdup(arch) : NULL);
 }
 
@@ -1236,7 +1215,7 @@ void rpmRebuildTargetVars(const char **buildtarget, const char ** canontarget)
 /*
  * XXX Make sure that per-arch optflags is initialized correctly.
  */
-  { char *optflags = rpmGetVarArch(RPMVAR_OPTFLAGS, ca);
+  { const char *optflags = rpmGetVarArch(RPMVAR_OPTFLAGS, ca);
     if (optflags != NULL) {
        delMacro(NULL, "optflags");
        addMacro(NULL, "optflags", NULL, optflags, RMIL_RPMRC);
@@ -1355,7 +1334,7 @@ int rpmShowRC(FILE *f)
 
     fprintf(f, "\nRPMRC VALUES:\n");
     for (i = 0, opt = optionTable; i < optionTableSize; i++, opt++) {
-       char *s = rpmGetVar(opt->var);
+       const char *s = rpmGetVar(opt->var);
        if (s != NULL || rpmGetVerbosity() < RPMMESS_NORMAL)
            fprintf(f, "%-21s : %s\n", opt->name, s ? s : "(not set)");
     }
index 8289e29..46a5dba 100644 (file)
@@ -74,7 +74,8 @@ const char * rpmDetectPGPVersion(pgpVersion *pgpVer)
        char *pgpvbin;
        struct stat statbuf;
        
-       if (!pgpbin || ! (pgpvbin = (char *)alloca(strlen(pgpbin) + 2))) {
+       if (!(pgpbin && pgpbin[0] != '%') || ! (pgpvbin = (char *)alloca(strlen(pgpbin) + 2))) {
+         if (pgpbin) xfree(pgpbin);
          saved_pgp_version = -1;
          return NULL;
        }
index e81a5a3..c102035 100644 (file)
@@ -1,7 +1,7 @@
 #include "system.h"
 
 #include <rpmlib.h>
-#include <rpmmacro.h>  /* XXX for rpmGetPath */
+#include <rpmmacro.h>  /* XXX for rpmExpand */
 
 #include "depends.h"
 #include "fprint.h"
@@ -1029,6 +1029,7 @@ static void handleOverlappedFiles(TFI_t * fi, hashTable ht,
            ds->needed -= BLOCK_ROUND(fixupSize, ds->block);
        }
     }
+    if (filespec) free(filespec);
 }
 
 static int ensureOlder(rpmdb db, Header new, int dbOffset, rpmProblemSet probs,
@@ -1413,7 +1414,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
     chdir("/");
     /*@-unrecog@*/ chroot(ts->root); /*@=unrecog@*/
 
-    ht = htCreate(totalFileCount * 2, 0, fpHashFunction, fpEqual);
+    ht = htCreate(totalFileCount * 2, 0, 0, fpHashFunction, fpEqual);
     fpc = fpCacheCreate(totalFileCount);
 
     /* ===============================================
index 61fad49..89ba72b 100644 (file)
@@ -370,7 +370,7 @@ char * oldrpmdbGetPackageGroup(struct oldrpmdb * oldrpmdb, struct oldrpmdbLabel
     
     rec = gdbm_fetch(oldrpmdb->groupIndex, key);
     if (!rec.dptr) {
-       return strdup("Unknown");
+       return xstrdup("Unknown");
     }
     
     g = malloc(rec.dsize + 1);
@@ -467,8 +467,8 @@ int oldrpmdbGetPackageInfo(struct oldrpmdb * oldrpmdb, struct oldrpmdbLabel labe
     list = splitString(rec.dptr, rec.dsize, '\1');
     free(rec.dptr);
 
-    pinfo->version = strdup(list[1]); 
-    pinfo->release = strdup(list[2]); 
+    pinfo->version = xstrdup(list[1]); 
+    pinfo->release = xstrdup(list[2]); 
     /* list[3] == "1" always */
     pinfo->name = malloc(strlen(list[0]) + strlen(list[4]) + 2);
     strcpy(pinfo->name, list[0]);
@@ -484,7 +484,7 @@ int oldrpmdbGetPackageInfo(struct oldrpmdb * oldrpmdb, struct oldrpmdbLabel labe
     strcat(pinfo->labelstr, ":");
     strcat(pinfo->labelstr, pinfo->release);
 
-    pinfo->preamble = strdup(list[5]);
+    pinfo->preamble = xstrdup(list[5]);
     pinfo->installTime = atoi(list[6]);
     pinfo->fileCount = atoi(list[7]);
     
@@ -498,27 +498,27 @@ int oldrpmdbGetPackageInfo(struct oldrpmdb * oldrpmdb, struct oldrpmdbLabel labe
 
     for (strptr = prelist; *strptr; strptr++) {
        if (!strncasecmp("Description: ", *strptr, 13))
-           pinfo->description = strdup((*strptr) + 13);
+           pinfo->description = xstrdup((*strptr) + 13);
        else if (!strncasecmp("Copyright: ", *strptr, 11))
-           pinfo->copyright = strdup((*strptr) + 11);
+           pinfo->copyright = xstrdup((*strptr) + 11);
        else if (!strncasecmp("Distribution: ", *strptr, 14))
-           pinfo->distribution = strdup((*strptr) + 14);
+           pinfo->distribution = xstrdup((*strptr) + 14);
        else if (!strncasecmp("Vendor: ", *strptr, 8))
-           pinfo->vendor = strdup((*strptr) + 8);
+           pinfo->vendor = xstrdup((*strptr) + 8);
        else if (!strncasecmp("size: ", *strptr, 6))
            pinfo->size = atoi((*strptr) + 6);
        else if (!strncasecmp("BuildDate: ", *strptr, 11))
            pinfo->buildTime =atoi((*strptr) + 11);
        else if (!strncasecmp("BuildHost: ", *strptr, 11))
-           pinfo->buildHost = strdup((*strptr) + 11);
+           pinfo->buildHost = xstrdup((*strptr) + 11);
     }
     freeSplitString(prelist);
 
-    if (!pinfo->vendor) pinfo->vendor = strdup("");
-    if (!pinfo->description) pinfo->description = strdup("");
-    if (!pinfo->distribution) pinfo->distribution = strdup("");
+    if (!pinfo->vendor) pinfo->vendor = xstrdup("");
+    if (!pinfo->description) pinfo->description = xstrdup("");
+    if (!pinfo->distribution) pinfo->distribution = xstrdup("");
     if (!pinfo->copyright) {
-       pinfo->copyright = strdup("");
+       pinfo->copyright = xstrdup("");
        fprintf(stdout, _("no copyright!\n"));
     }
 
index 5f7126f..c09fffe 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-10-27 18:55-0400\n"
+"POT-Creation-Date: 1999-10-29 11:30-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -39,85 +39,85 @@ msgstr ""
 msgid "Failed to read spec file from %s\n"
 msgstr ""
 
-#: build.c:163
+#: build.c:166
 #, c-format
 msgid "Failed to rename %s to %s: %s\n"
 msgstr ""
 
-#: build.c:201
+#: build.c:200
 #, c-format
 msgid "File is not a regular file: %s\n"
 msgstr ""
 
-#: build.c:207
+#: build.c:206
 #, c-format
 msgid "File %s does not appear to be a specfile.\n"
 msgstr ""
 
 #. parse up the build operators
-#: build.c:258
+#: build.c:257
 #, c-format
 msgid "Building target platforms: %s\n"
 msgstr ""
 
-#: build.c:267
+#: build.c:266
 #, c-format
 msgid "Building for target %s\n"
 msgstr ""
 
-#: build.c:313
+#: build.c:312
 msgid "buildroot already specified"
 msgstr ""
 
-#: build.c:320
+#: build.c:319
 msgid "--buildarch has been obsoleted.  Use the --target option instead.\n"
 msgstr ""
 
-#: build.c:324
+#: build.c:323
 msgid "--buildos has been obsoleted.  Use the --target option instead.\n"
 msgstr ""
 
-#: build.c:345
+#: build.c:344
 msgid "override build architecture"
 msgstr ""
 
-#: build.c:347
+#: build.c:346
 msgid "override build operating system"
 msgstr ""
 
-#: build.c:349
+#: build.c:348
 msgid "override build root"
 msgstr ""
 
-#: build.c:351 rpm.c:457
+#: build.c:350 rpm.c:457
 msgid "remove build tree when done"
 msgstr ""
 
-#: build.c:353
+#: build.c:352
 msgid "do not execute any stages of the build"
 msgstr ""
 
-#: build.c:355
+#: build.c:354
 msgid "do not accept I18N msgstr's from specfile"
 msgstr ""
 
-#: build.c:357
+#: build.c:356
 msgid "remove sources when done"
 msgstr ""
 
-#: build.c:359
+#: build.c:358
 msgid "remove specfile when done"
 msgstr ""
 
-#: build.c:361 rpm.c:455
+#: build.c:360 rpm.c:455
 msgid "skip straight to specified stage (only for c,i)"
 msgstr ""
 
-#: build.c:363
+#: build.c:362
 msgid "override target platform"
 msgstr ""
 
-#: build.c:365
+#: build.c:364
 msgid "lookup I18N strings in specfile catalog"
 msgstr ""
 
@@ -1224,7 +1224,7 @@ msgstr ""
 msgid "error reading header from package\n"
 msgstr ""
 
-#: build/build.c:83 build/pack.c:267
+#: build/build.c:83 build/pack.c:270
 msgid "Unable to open temp file"
 msgstr ""
 
@@ -1301,269 +1301,269 @@ msgstr ""
 msgid "TIMECHECK failure: %s\n"
 msgstr ""
 
-#: build/files.c:269 build/files.c:351 build/files.c:514
+#: build/files.c:270 build/files.c:352 build/files.c:515
 #, c-format
 msgid "Missing '(' in %s %s"
 msgstr ""
 
-#: build/files.c:280 build/files.c:468 build/files.c:525
+#: build/files.c:281 build/files.c:469 build/files.c:526
 #, c-format
 msgid "Missing ')' in %s(%s"
 msgstr ""
 
-#: build/files.c:318 build/files.c:493
+#: build/files.c:319 build/files.c:494
 #, c-format
 msgid "Invalid %s token: %s"
 msgstr ""
 
-#: build/files.c:367
+#: build/files.c:368
 #, c-format
 msgid "Non-white space follows %s(): %s"
 msgstr ""
 
-#: build/files.c:405
+#: build/files.c:406
 #, c-format
 msgid "Bad syntax: %s(%s)"
 msgstr ""
 
-#: build/files.c:415
+#: build/files.c:416
 #, c-format
 msgid "Bad mode spec: %s(%s)"
 msgstr ""
 
-#: build/files.c:427
+#: build/files.c:428
 #, c-format
 msgid "Bad dirmode spec: %s(%s)"
 msgstr ""
 
-#: build/files.c:551
+#: build/files.c:552
 msgid "Unusual locale length: \"%.*s\" in %%lang(%s)"
 msgstr ""
 
-#: build/files.c:561
+#: build/files.c:562
 msgid "Duplicate locale %.*s in %%lang(%s)"
 msgstr ""
 
-#: build/files.c:653
+#: build/files.c:657
 msgid "Hit limit for %%docdir"
 msgstr ""
 
-#: build/files.c:659
+#: build/files.c:663
 msgid "Only one arg for %%docdir"
 msgstr ""
 
 #. We already got a file -- error
-#: build/files.c:684
+#: build/files.c:688
 #, c-format
 msgid "Two files on one line: %s"
 msgstr ""
 
-#: build/files.c:697
+#: build/files.c:701
 #, c-format
 msgid "File must begin with \"/\": %s"
 msgstr ""
 
-#: build/files.c:709
+#: build/files.c:713
 msgid "Can't mix special %%doc with other forms: %s"
 msgstr ""
 
-#: build/files.c:795
+#: build/files.c:799
 #, c-format
 msgid "File listed twice: %s"
 msgstr ""
 
-#: build/files.c:953
+#: build/files.c:957
 #, c-format
 msgid "File doesn't match prefix (%s): %s"
 msgstr ""
 
-#: build/files.c:963
+#: build/files.c:967
 #, c-format
 msgid "File not found: %s"
 msgstr ""
 
-#: build/files.c:1006
+#: build/files.c:1010
 #, c-format
 msgid "Bad owner/group: %s\n"
 msgstr ""
 
-#: build/files.c:1020
+#: build/files.c:1024
 #, c-format
 msgid "File %4d: %07o %s.%s\t %s\n"
 msgstr ""
 
-#: build/files.c:1090
+#: build/files.c:1094
 #, c-format
 msgid "File needs leading \"/\": %s"
 msgstr ""
 
-#: build/files.c:1134
+#: build/files.c:1138
 #, c-format
 msgid "File not found by glob: %s"
 msgstr ""
 
-#: build/files.c:1176
+#: build/files.c:1182
 msgid "Could not open %%files file: %s"
 msgstr ""
 
-#: build/files.c:1183 build/pack.c:488
+#: build/files.c:1188 build/pack.c:491
 #, c-format
 msgid "line: %s"
 msgstr ""
 
-#: build/files.c:1510 build/parsePrep.c:29
+#: build/files.c:1515 build/parsePrep.c:29
 #, c-format
 msgid "Bad owner/group: %s"
 msgstr ""
 
-#: build/files.c:1564
+#: build/files.c:1569
 #, c-format
 msgid "Couldn't exec %s: %s"
 msgstr ""
 
-#: build/files.c:1569
+#: build/files.c:1574
 #, c-format
 msgid "Couldn't fork %s: %s"
 msgstr ""
 
-#: build/files.c:1651
+#: build/files.c:1656
 #, c-format
 msgid "%s failed"
 msgstr ""
 
-#: build/files.c:1655
+#: build/files.c:1660
 #, c-format
 msgid "failed to write all data to %s"
 msgstr ""
 
-#: build/files.c:1744
+#: build/files.c:1749
 #, c-format
 msgid "Finding  %s: (using %s)...\n"
 msgstr ""
 
-#: build/files.c:1772 build/files.c:1781
+#: build/files.c:1777 build/files.c:1786
 #, c-format
 msgid "Failed to find %s:"
 msgstr ""
 
-#: build/files.c:1887
+#: build/files.c:1892
 #, c-format
 msgid "Processing files: %s-%s-%s\n"
 msgstr ""
 
-#: build/names.c:32 build/names.c:64
+#: build/names.c:41 build/names.c:73
 msgid "RPMERR_INTERNAL: Hit limit in getUname()\n"
 msgstr ""
 
-#: build/names.c:97 build/names.c:129
+#: build/names.c:106 build/names.c:138
 msgid "RPMERR_INTERNAL: Hit limit in getGname()\n"
 msgstr ""
 
-#: build/names.c:167
+#: build/names.c:176
 #, c-format
 msgid "Could not canonicalize hostname: %s\n"
 msgstr ""
 
-#: build/pack.c:132
+#: build/pack.c:134
 #, c-format
 msgid "Could not generate output filename for package %s: %s\n"
 msgstr ""
 
-#: build/pack.c:149
+#: build/pack.c:151
 #, c-format
 msgid "cannot create %s: %s\n"
 msgstr ""
 
-#: build/pack.c:184
+#: build/pack.c:187
 #, c-format
 msgid "readRPM: open %s: %s\n"
 msgstr ""
 
-#: build/pack.c:194
+#: build/pack.c:197
 #, c-format
 msgid "readRPM: read %s: %s\n"
 msgstr ""
 
-#: build/pack.c:215
+#: build/pack.c:218
 #, c-format
 msgid "readRPM: %s is not an RPM package\n"
 msgstr ""
 
-#: build/pack.c:221
+#: build/pack.c:224
 #, c-format
 msgid "readRPM: reading header from %s\n"
 msgstr ""
 
-#: build/pack.c:278
+#: build/pack.c:281
 msgid "Bad CSA data"
 msgstr ""
 
-#: build/pack.c:311
+#: build/pack.c:314
 #, c-format
 msgid "Could not open %s\n"
 msgstr ""
 
-#: build/pack.c:343 build/pack.c:385
+#: build/pack.c:346 build/pack.c:388
 #, c-format
 msgid "Unable to write package: %s"
 msgstr ""
 
-#: build/pack.c:358
+#: build/pack.c:361
 #, c-format
 msgid "Generating signature: %d\n"
 msgstr ""
 
-#: build/pack.c:375
+#: build/pack.c:378
 #, c-format
 msgid "Unable to read sigtarget: %s"
 msgstr ""
 
-#: build/pack.c:400
+#: build/pack.c:403
 #, c-format
 msgid "Wrote: %s\n"
 msgstr ""
 
-#: build/pack.c:416 build/pack.c:439
+#: build/pack.c:419 build/pack.c:442
 #, c-format
 msgid "create archive failed on file %s: %s"
 msgstr ""
 
-#: build/pack.c:458
+#: build/pack.c:461
 #, c-format
 msgid "cpio_copy write failed: %s"
 msgstr ""
 
-#: build/pack.c:465
+#: build/pack.c:468
 #, c-format
 msgid "cpio_copy read failed: %s"
 msgstr ""
 
-#: build/pack.c:544
+#: build/pack.c:547
 #, c-format
 msgid "Could not open PreIn file: %s"
 msgstr ""
 
-#: build/pack.c:551
+#: build/pack.c:554
 #, c-format
 msgid "Could not open PreUn file: %s"
 msgstr ""
 
-#: build/pack.c:558
+#: build/pack.c:561
 #, c-format
 msgid "Could not open PostIn file: %s"
 msgstr ""
 
-#: build/pack.c:565
+#: build/pack.c:568
 #, c-format
 msgid "Could not open PostUn file: %s"
 msgstr ""
 
-#: build/pack.c:573
+#: build/pack.c:576
 #, c-format
 msgid "Could not open VerifyScript file: %s"
 msgstr ""
 
-#: build/pack.c:589
+#: build/pack.c:592
 #, c-format
 msgid "Could not open Trigger script file: %s"
 msgstr ""
@@ -1654,7 +1654,7 @@ msgstr ""
 msgid "%s field must be present in package: %s"
 msgstr ""
 
-#: build/parsePreamble.c:192
+#: build/parsePreamble.c:194
 #, c-format
 msgid "Duplicate %s entries in package: %s"
 msgstr ""
@@ -1911,51 +1911,51 @@ msgstr ""
 msgid "line %d: Bad %s number: %s\n"
 msgstr ""
 
-#: lib/cpio.c:335
+#: lib/cpio.c:331
 #, c-format
 msgid "can't rename %s to %s: %s\n"
 msgstr ""
 
-#: lib/cpio.c:341
+#: lib/cpio.c:337
 #, c-format
 msgid "can't unlink %s: %s\n"
 msgstr ""
 
-#: lib/cpio.c:532
+#: lib/cpio.c:528
 #, c-format
 msgid "getNextHeader: %s\n"
 msgstr ""
 
-#: lib/cpio.c:995
+#: lib/cpio.c:991
 #, c-format
 msgid "(error 0x%x)"
 msgstr ""
 
-#: lib/cpio.c:998
+#: lib/cpio.c:994
 msgid "Bad magic"
 msgstr ""
 
-#: lib/cpio.c:999
+#: lib/cpio.c:995
 msgid "Bad/unreadable  header"
 msgstr ""
 
-#: lib/cpio.c:1017
+#: lib/cpio.c:1013
 msgid "Header size too big"
 msgstr ""
 
-#: lib/cpio.c:1018
+#: lib/cpio.c:1014
 msgid "Unknown file type"
 msgstr ""
 
-#: lib/cpio.c:1019
+#: lib/cpio.c:1015
 msgid "Missing hard link"
 msgstr ""
 
-#: lib/cpio.c:1020
+#: lib/cpio.c:1016
 msgid "Internal error"
 msgstr ""
 
-#: lib/cpio.c:1029
+#: lib/cpio.c:1025
 msgid " failed - "
 msgstr ""
 
@@ -1996,69 +1996,69 @@ msgstr ""
 msgid "dbrecMatchesDepFlags() failed to read header"
 msgstr ""
 
-#: lib/depends.c:760
+#: lib/depends.c:761
 #, c-format
 msgid "%s: %s satisfied by added file list.\n"
 msgstr ""
 
-#: lib/depends.c:799
+#: lib/depends.c:800
 #, c-format
 msgid "%s: %s satisfied by added package.\n"
 msgstr ""
 
-#: lib/depends.c:816
+#: lib/depends.c:817
 #, c-format
 msgid "%s: %s satisfied by added provide.\n"
 msgstr ""
 
-#: lib/depends.c:847
+#: lib/depends.c:848
 #, c-format
 msgid "%s: %s satisfied by rpmrc provides.\n"
 msgstr ""
 
-#: lib/depends.c:875
+#: lib/depends.c:876
 #, c-format
 msgid "%s: %s satisfied by db file lists.\n"
 msgstr ""
 
-#: lib/depends.c:897
+#: lib/depends.c:898
 #, c-format
 msgid "%s: %s satisfied by db provides.\n"
 msgstr ""
 
-#: lib/depends.c:919
+#: lib/depends.c:920
 #, c-format
 msgid "%s: %s satisfied by db packages.\n"
 msgstr ""
 
-#: lib/depends.c:932
+#: lib/depends.c:933
 #, c-format
 msgid "%s: %s satisfied by rpmlib version.\n"
 msgstr ""
 
-#: lib/depends.c:942
+#: lib/depends.c:943
 #, c-format
 msgid "%s: %s unsatisfied.\n"
 msgstr ""
 
 #. requirements are not satisfied.
-#: lib/depends.c:990
+#: lib/depends.c:991
 #, c-format
 msgid "package %s require not satisfied: %s\n"
 msgstr ""
 
 #. conflicts exist.
-#: lib/depends.c:1052
+#: lib/depends.c:1053
 #, c-format
 msgid "package %s conflicts: %s\n"
 msgstr ""
 
-#: lib/depends.c:1107 lib/depends.c:1415
+#: lib/depends.c:1108 lib/depends.c:1416
 #, c-format
 msgid "cannot read header at %d for dependency check"
 msgstr ""
 
-#: lib/depends.c:1202
+#: lib/depends.c:1203
 #, c-format
 msgid "loop in prerequisite chain: %s"
 msgstr ""
@@ -2078,26 +2078,26 @@ msgstr ""
 msgid "(not a number)"
 msgstr ""
 
-#: lib/fs.c:40
+#: lib/fs.c:56
 #, c-format
 msgid "mntctl() failed to return fugger size: %s"
 msgstr ""
 
-#: lib/fs.c:75 lib/fs.c:253
+#: lib/fs.c:91 lib/fs.c:260
 #, c-format
 msgid "failed to stat %s: %s"
 msgstr ""
 
-#: lib/fs.c:114
+#: lib/fs.c:127
 msgid "getting list of mounted filesystems\n"
 msgstr ""
 
-#: lib/fs.c:119
+#: lib/fs.c:132
 #, c-format
 msgid "failed to open %s: %s"
 msgstr ""
 
-#: lib/fs.c:274
+#: lib/fs.c:282
 #, c-format
 msgid "file %s is on an unknown device"
 msgstr ""
@@ -2728,57 +2728,57 @@ msgstr ""
 msgid "rebuilding database in rootdir %s\n"
 msgstr ""
 
-#: lib/rebuilddb.c:24 lib/rpmdb.c:69 lib/rpmdb.c:88 lib/rpmdb.c:105
+#: lib/rebuilddb.c:24 lib/rpmdb.c:68 lib/rpmdb.c:84 lib/rpmdb.c:99
 msgid "no dbpath has been set"
 msgstr ""
 
-#: lib/rebuilddb.c:33
+#: lib/rebuilddb.c:34
 #, c-format
 msgid "temporary database %s already exists"
 msgstr ""
 
-#: lib/rebuilddb.c:37
+#: lib/rebuilddb.c:38
 #, c-format
 msgid "creating directory: %s\n"
 msgstr ""
 
-#: lib/rebuilddb.c:39
+#: lib/rebuilddb.c:40
 #, c-format
 msgid "error creating directory %s: %s"
 msgstr ""
 
-#: lib/rebuilddb.c:43
+#: lib/rebuilddb.c:44
 msgid "opening old database\n"
 msgstr ""
 
-#: lib/rebuilddb.c:50
+#: lib/rebuilddb.c:51
 msgid "opening new database\n"
 msgstr ""
 
-#: lib/rebuilddb.c:60 lib/rebuilddb.c:78
+#: lib/rebuilddb.c:61 lib/rebuilddb.c:79
 #, c-format
 msgid "record number %d in database is bad -- skipping it"
 msgstr ""
 
-#: lib/rebuilddb.c:72
+#: lib/rebuilddb.c:73
 #, c-format
 msgid "cannot add record originally at %d"
 msgstr ""
 
-#: lib/rebuilddb.c:91
+#: lib/rebuilddb.c:92
 msgid "failed to rebuild database; original database remains in place\n"
 msgstr ""
 
-#: lib/rebuilddb.c:99
+#: lib/rebuilddb.c:100
 msgid "failed to replace old database with new database!\n"
 msgstr ""
 
-#: lib/rebuilddb.c:101
+#: lib/rebuilddb.c:102
 #, c-format
 msgid "replaces files in %s with files from %s to recover"
 msgstr ""
 
-#: lib/rebuilddb.c:107
+#: lib/rebuilddb.c:108
 #, c-format
 msgid "failed to remove directory %s: %s\n"
 msgstr ""
@@ -2842,129 +2842,129 @@ msgstr ""
 msgid "%s: No signature available (v1.0 RPM)\n"
 msgstr ""
 
-#: lib/rpmchecksig.c:408
+#: lib/rpmchecksig.c:411
 msgid "NOT OK"
 msgstr ""
 
-#: lib/rpmchecksig.c:409 lib/rpmchecksig.c:423
+#: lib/rpmchecksig.c:412 lib/rpmchecksig.c:426
 msgid " (MISSING KEYS:"
 msgstr ""
 
-#: lib/rpmchecksig.c:411 lib/rpmchecksig.c:425
+#: lib/rpmchecksig.c:414 lib/rpmchecksig.c:428
 msgid ") "
 msgstr ""
 
-#: lib/rpmchecksig.c:412 lib/rpmchecksig.c:426
+#: lib/rpmchecksig.c:415 lib/rpmchecksig.c:429
 msgid " (UNTRUSTED KEYS:"
 msgstr ""
 
-#: lib/rpmchecksig.c:414 lib/rpmchecksig.c:428
+#: lib/rpmchecksig.c:417 lib/rpmchecksig.c:431
 msgid ")"
 msgstr ""
 
-#: lib/rpmchecksig.c:422
+#: lib/rpmchecksig.c:425
 msgid "OK"
 msgstr ""
 
-#: lib/rpmdb.c:184
+#: lib/rpmdb.c:177
 #, c-format
 msgid "opening database mode 0x%x in %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:193 lib/url.c:431
+#: lib/rpmdb.c:186 lib/url.c:431
 #, c-format
 msgid "failed to open %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:206 lib/rpmdb.c:214
+#: lib/rpmdb.c:199 lib/rpmdb.c:207
 #, c-format
 msgid "cannot get %s lock on database"
 msgstr ""
 
-#: lib/rpmdb.c:207
+#: lib/rpmdb.c:200
 msgid "exclusive"
 msgstr ""
 
-#: lib/rpmdb.c:215
+#: lib/rpmdb.c:208
 msgid "shared"
 msgstr ""
 
-#: lib/rpmdb.c:246
+#: lib/rpmdb.c:239
 msgid ""
 "old format database is present; use --rebuilddb to generate a new format "
 "database"
 msgstr ""
 
-#: lib/rpmdb.c:468
+#: lib/rpmdb.c:461
 #, c-format
 msgid "package %s not listed in %s"
 msgstr ""
 
-#: lib/rpmdb.c:479
+#: lib/rpmdb.c:472
 #, c-format
 msgid "package %s not found in %s"
 msgstr ""
 
-#: lib/rpmdb.c:503 lib/uninstall.c:85
+#: lib/rpmdb.c:496 lib/uninstall.c:85
 #, c-format
 msgid "cannot read header at %d for uninstall"
 msgstr ""
 
-#: lib/rpmdb.c:511
+#: lib/rpmdb.c:504
 msgid "package has no name"
 msgstr ""
 
-#: lib/rpmdb.c:513
+#: lib/rpmdb.c:506
 msgid "removing name index\n"
 msgstr ""
 
-#: lib/rpmdb.c:518
+#: lib/rpmdb.c:511
 msgid "package has no group\n"
 msgstr ""
 
-#: lib/rpmdb.c:520
+#: lib/rpmdb.c:513
 msgid "removing group index\n"
 msgstr ""
 
-#: lib/rpmdb.c:527
+#: lib/rpmdb.c:520
 #, c-format
 msgid "removing provides index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:542
+#: lib/rpmdb.c:535
 #, c-format
 msgid "removing requiredby index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:554
+#: lib/rpmdb.c:547
 #, c-format
 msgid "removing trigger index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:565
+#: lib/rpmdb.c:558
 #, c-format
 msgid "removing conflict index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:576
+#: lib/rpmdb.c:569
 #, c-format
 msgid "removing file index for %s\n"
 msgstr ""
 
-#: lib/rpmdb.c:585
+#: lib/rpmdb.c:578
 msgid "package has no files\n"
 msgstr ""
 
-#: lib/rpmdb.c:667
+#: lib/rpmdb.c:660
 msgid "cannot allocate space for database"
 msgstr ""
 
-#: lib/rpmdb.c:726
+#: lib/rpmdb.c:719
 #, c-format
 msgid "cannot read header at %d for update"
 msgstr ""
 
-#: lib/rpmdb.c:735
+#: lib/rpmdb.c:728
 msgid "header changed size!"
 msgstr ""
 
@@ -3068,229 +3068,229 @@ msgstr ""
 msgid "read failed: %s (%d)"
 msgstr ""
 
-#: lib/rpmrc.c:177
+#: lib/rpmrc.c:142
 #, c-format
 msgid "missing second ':' at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:180
+#: lib/rpmrc.c:145
 #, c-format
 msgid "missing architecture name at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:328
+#: lib/rpmrc.c:299
 #, c-format
 msgid "Incomplete data line at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:332
+#: lib/rpmrc.c:303
 #, c-format
 msgid "Too many args in data line at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:339
+#: lib/rpmrc.c:310
 #, c-format
 msgid "Bad arch/os number: %s (%s:%d)"
 msgstr ""
 
-#: lib/rpmrc.c:373
+#: lib/rpmrc.c:344
 #, c-format
 msgid "Incomplete default line at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:378
+#: lib/rpmrc.c:349
 #, c-format
 msgid "Too many args in default line at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:561
+#: lib/rpmrc.c:532
 #, c-format
 msgid "Cannot expand %s"
 msgstr ""
 
-#: lib/rpmrc.c:576
+#: lib/rpmrc.c:547
 #, c-format
 msgid "Unable to open %s for reading: %s."
 msgstr ""
 
-#: lib/rpmrc.c:608
+#: lib/rpmrc.c:585
 #, c-format
 msgid "Failed to read %s: %s."
 msgstr ""
 
-#: lib/rpmrc.c:638
+#: lib/rpmrc.c:615
 #, c-format
 msgid "missing ':' at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:655 lib/rpmrc.c:730
+#: lib/rpmrc.c:632 lib/rpmrc.c:707
 #, c-format
 msgid "missing argument for %s at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:672 lib/rpmrc.c:695
+#: lib/rpmrc.c:649 lib/rpmrc.c:672
 #, c-format
 msgid "%s expansion failed at %s:%d \"%s\""
 msgstr ""
 
-#: lib/rpmrc.c:681
+#: lib/rpmrc.c:658
 #, c-format
 msgid "cannot open %s at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:722
+#: lib/rpmrc.c:699
 #, c-format
 msgid "missing architecture for %s at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:789
+#: lib/rpmrc.c:766
 #, c-format
 msgid "bad option '%s' at %s:%d"
 msgstr ""
 
-#: lib/rpmrc.c:1149
+#: lib/rpmrc.c:1128
 #, c-format
 msgid "Unknown system: %s\n"
 msgstr ""
 
-#: lib/rpmrc.c:1150
+#: lib/rpmrc.c:1129
 msgid "Please contact rpm-list@redhat.com\n"
 msgstr ""
 
-#: lib/signature.c:106
+#: lib/signature.c:107
 #, c-format
 msgid "sigsize         : %d\n"
 msgstr ""
 
-#: lib/signature.c:107
+#: lib/signature.c:108
 #, c-format
 msgid "Header + Archive: %d\n"
 msgstr ""
 
-#: lib/signature.c:108
+#: lib/signature.c:109
 #, c-format
 msgid "expected size   : %d\n"
 msgstr ""
 
-#: lib/signature.c:112
+#: lib/signature.c:113
 msgid "file is not regular -- skipping size check\n"
 msgstr ""
 
-#: lib/signature.c:134
+#: lib/signature.c:135
 msgid "No signature\n"
 msgstr ""
 
-#: lib/signature.c:137
+#: lib/signature.c:138
 msgid "Old PGP signature\n"
 msgstr ""
 
-#: lib/signature.c:149
+#: lib/signature.c:150
 msgid "Old (internal-only) signature!  How did you get that!?"
 msgstr ""
 
-#: lib/signature.c:153
+#: lib/signature.c:154
 msgid "New Header signature\n"
 msgstr ""
 
 #. 8-byte pad
-#: lib/signature.c:160 lib/signature.c:202
+#: lib/signature.c:161 lib/signature.c:203
 #, c-format
 msgid "Signature size: %d\n"
 msgstr ""
 
-#: lib/signature.c:161 lib/signature.c:203
+#: lib/signature.c:162 lib/signature.c:204
 #, c-format
 msgid "Signature pad : %d\n"
 msgstr ""
 
-#: lib/signature.c:266
+#: lib/signature.c:267
 #, c-format
 msgid "Couldn't exec pgp (%s)"
 msgstr ""
 
-#: lib/signature.c:277
+#: lib/signature.c:278
 msgid "pgp failed"
 msgstr ""
 
 #. PGP failed to write signature
 #. Just in case
-#: lib/signature.c:284
+#: lib/signature.c:285
 msgid "pgp failed to write signature"
 msgstr ""
 
-#: lib/signature.c:289
+#: lib/signature.c:290
 #, c-format
 msgid "PGP sig size: %d\n"
 msgstr ""
 
-#: lib/signature.c:300 lib/signature.c:377
+#: lib/signature.c:301 lib/signature.c:378
 msgid "unable to read the signature"
 msgstr ""
 
-#: lib/signature.c:305
+#: lib/signature.c:306
 #, c-format
 msgid "Got %d bytes of PGP sig\n"
 msgstr ""
 
-#: lib/signature.c:343 lib/signature.c:686
+#: lib/signature.c:344 lib/signature.c:687
 msgid "Couldn't exec gpg"
 msgstr ""
 
-#: lib/signature.c:354
+#: lib/signature.c:355
 msgid "gpg failed"
 msgstr ""
 
 #. GPG failed to write signature
 #. Just in case
-#: lib/signature.c:361
+#: lib/signature.c:362
 msgid "gpg failed to write signature"
 msgstr ""
 
-#: lib/signature.c:366
+#: lib/signature.c:367
 #, c-format
 msgid "GPG sig size: %d\n"
 msgstr ""
 
-#: lib/signature.c:382
+#: lib/signature.c:383
 #, c-format
 msgid "Got %d bytes of GPG sig\n"
 msgstr ""
 
-#: lib/signature.c:409
+#: lib/signature.c:410
 msgid "Generating signature using PGP.\n"
 msgstr ""
 
-#: lib/signature.c:415
+#: lib/signature.c:416
 msgid "Generating signature using GPG.\n"
 msgstr ""
 
-#: lib/signature.c:492 lib/signature.c:554
+#: lib/signature.c:493 lib/signature.c:555
 msgid "Could not run pgp.  Use --nopgp to skip PGP checks."
 msgstr ""
 
-#: lib/signature.c:552 lib/signature.c:625
+#: lib/signature.c:553 lib/signature.c:626
 msgid "exec failed!\n"
 msgstr ""
 
-#: lib/signature.c:627
+#: lib/signature.c:628
 msgid "Could not run gpg.  Use --nogpg to skip GPG checks."
 msgstr ""
 
-#: lib/signature.c:715
+#: lib/signature.c:716
 msgid "Couldn't exec pgp"
 msgstr ""
 
 #. @notreached@
 #. This case should have been screened out long ago.
-#: lib/signature.c:719 lib/signature.c:772
+#: lib/signature.c:720 lib/signature.c:773
 msgid "Invalid %%_signature spec in macro file"
 msgstr ""
 
-#: lib/signature.c:752
+#: lib/signature.c:753
 msgid "You must set \"%%_gpg_name\" in your macro file"
 msgstr ""
 
-#: lib/signature.c:764
+#: lib/signature.c:765
 msgid "You must set \"%%_pgp_name\" in your macro file"
 msgstr ""
 
index 7e9bfbf..309f012 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-10-26 13:07-0400\n"
+"POT-Creation-Date: 1999-10-29 09:03-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
index 75c8b92..283cf83 100644 (file)
@@ -59,9 +59,13 @@ poptContext poptGetContext(const char * name, int argc, const char ** argv,
 
     con->leftovers = calloc( (argc + 1), sizeof(char *) );
     con->options = options;
+    con->aliases = NULL;
+    con->numAliases = 0;
+    con->flags = flags;
+    con->execs = NULL;
+    con->numExecs = 0;
     con->finalArgvAlloced = argc * 2;
     con->finalArgv = calloc( con->finalArgvAlloced, sizeof(*con->finalArgv) );
-    con->flags = flags;
     con->execAbsolute = 1;
 
     if (getenv("POSIXLY_CORRECT") || getenv("POSIX_ME_HARDER"))
@@ -368,7 +372,7 @@ static /*@only@*/ const char * expandNextArg(poptContext con, const char * s)
        *te++ = c;
     }
     *te = '\0';
-    t = realloc(t, strlen(t));
+    t = realloc(t, strlen(t)); /* XXX memory leak, hard to plug */
     return t;
 }
 
@@ -513,6 +517,7 @@ int poptGetNextOpt(poptContext con)
 
                switch (opt->argInfo & POPT_ARG_MASK) {
                  case POPT_ARG_STRING:
+                   /* XXX memory leak, hard to plug */
                    *((const char **) opt->arg) = xstrdup(con->os->nextArg);
                    break;
 
@@ -609,7 +614,7 @@ void poptFreeContext(poptContext con) {
        if (con->execs[i].longName) xfree(con->execs[i].longName);
        xfree(con->execs[i].script);
     }
-    xfree(con->execs);
+    if (con->execs) xfree(con->execs);
 
     free(con->leftovers);
     free(con->finalArgv);
index 9d23862..7a1a4c2 100644 (file)
@@ -40,7 +40,7 @@ static void configLine(poptContext con, char * line) {
        alias.longName = longName, alias.shortName = shortName;
        poptAddAlias(con, alias, 0);
     } else if (!strcmp(entryType, "exec")) {
-       con->execs = realloc(con->execs, /* XXX memory leak */
+       con->execs = realloc(con->execs,
                                sizeof(*con->execs) * (con->numExecs + 1));
        if (longName)
            con->execs[con->numExecs].longName = xstrdup(longName);
diff --git a/rpm.c b/rpm.c
index bf99581..a4379e0 100755 (executable)
--- a/rpm.c
+++ b/rpm.c
@@ -1361,7 +1361,12 @@ int main(int argc, const char ** argv)
     }
 
     /* keeps memory leak checkers quiet */
+    freeNames();
+    freeFilesystems();
     if (qva->qva_queryFormat) xfree(qva->qva_queryFormat);
 
+#if HAVE_MCHECK_H && HAVE_MTRACE
+    muntrace();   /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
+#endif
     return ec;
 }
index 24d4b5d..2e65054 100644 (file)
@@ -1399,7 +1399,7 @@ rpmExpand(const char *arg, ...)
     }
     va_end(ap);
     expandMacros(NULL, NULL, buf, sizeof(buf));
-    return xstrdup(buf);       /* XXX build memory leaks */
+    return xstrdup(buf);
 }
 
 int
index 6cb552c..0a351e5 100644 (file)
@@ -650,7 +650,7 @@ DPRINTF(100, ("\n"));
                                                break;
                                }
                                if (l == nlangs)
-                                       onlylang[nlangs++] = strdup(lang);
+                                       onlylang[nlangs++] = xstrdup(lang);
                        }
                        lang = NULL;
                }
@@ -1005,7 +1005,7 @@ main(int argc, char **argv)
     while((c = getopt(argc, argv, "defgEMl:C:I:O:Tv")) != EOF)
     switch (c) {
     case 'C':
-       mastercatalogue = strdup(optarg);
+       mastercatalogue = xstrdup(optarg);
        break;
     case 'd':
        debug++;
@@ -1021,7 +1021,7 @@ main(int argc, char **argv)
        break;
     case 'l':
        gottalang = 1;
-       onlylang[nlangs++] = strdup(optarg);
+       onlylang[nlangs++] = xstrdup(optarg);
        break;
     case 'I':
        inputdir = optarg;