From 211c385eade66c3133127f7ef0ad644690df7e20 Mon Sep 17 00:00:00 2001 From: ewt Date: Wed, 11 Dec 1996 15:39:57 +0000 Subject: [PATCH] fixed the fix from memory leak plugging CVS patchset: 1220 CVS date: 1996/12/11 15:39:57 --- lib/install.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/install.c b/lib/install.c index 7effe5a..001b8ca 100644 --- a/lib/install.c +++ b/lib/install.c @@ -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, -- 2.7.4