fixed the fix from memory leak plugging <sigh>
authorewt <devnull@localhost>
Wed, 11 Dec 1996 15:39:57 +0000 (15:39 +0000)
committerewt <devnull@localhost>
Wed, 11 Dec 1996 15:39:57 +0000 (15:39 +0000)
CVS patchset: 1220
CVS date: 1996/12/11 15:39:57

lib/install.c

index 7effe5a..001b8ca 100644 (file)
@@ -141,6 +141,7 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
     int * intptr;
     char * archivePrefix, * tmpPath;
     int scriptArg;
+    int hasOthers = 0;
     int relocationSize = 1;            /* strip at least first / for cpio */
     uint_32 * archiveSizePtr;
 
@@ -235,10 +236,12 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
 
     rc = rpmdbFindPackage(db, name, &matches);
     if (rc == -1) return 2;
-    if (rc)
+    if (rc) {
        scriptArg = 1;
-    else
+       hasOthers = 1;
+    } else {
        scriptArg = matches.count + 1;
+    }
 
     /* This canonicalizes the root */
     if (rootdir && rootdir[rootLength] == '/') {
@@ -251,7 +254,7 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
        rootdir = newRootdir;
     }
 
-    if (flags & RPMINSTALL_UPGRADE) {
+    if (flags & RPMINSTALL_UPGRADE && hasOthers) {
        /* 
           We need to get a list of all old version of this package. We let
           this install procede normally then, but:
@@ -280,9 +283,10 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
            }
            *intptr++ = 0;
        }
+    }
 
+    if (hasOthers) 
        dbiFreeIndexRecord(matches);
-    }
 
     fileList = NULL;
     if (headerGetEntry(h, RPMTAG_FILENAMES, &type, (void **) &fileList,