summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-11-05 14:10:16 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-11-05 14:10:16 +0200
commitc0a6f7b14169adb0f3961f6ccda8ca49eb87fead (patch)
treeb3b908a317801af8102004852112aba44aa425cc
parented412a0e2f8538ab952908b06f24d769f1fd1fb6 (diff)
downloadrpm-c0a6f7b14169adb0f3961f6ccda8ca49eb87fead.tar.gz
rpm-c0a6f7b14169adb0f3961f6ccda8ca49eb87fead.tar.bz2
rpm-c0a6f7b14169adb0f3961f6ccda8ca49eb87fead.zip
Stop messing with fi->fstates allocations in psm
- it's alloced and freed by rpmfiNew()/Free() always anyway
-rw-r--r--lib/psm.c7
-rw-r--r--lib/rpmfi.c8
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/psm.c b/lib/psm.c
index abf3b5da3..3b7437968 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -1276,12 +1276,6 @@ assert(psm->mi == NULL);
psm->mi = rpmdbFreeIterator(psm->mi);
rc = RPMRC_OK;
- /* XXX lazy alloc here may need to be done elsewhere. */
- if (fi->fstates == NULL && fc > 0) {
- fi->fstates = xmalloc(sizeof(*fi->fstates) * fc);
- memset(fi->fstates, RPMFILE_STATE_NORMAL, fc);
- }
-
if (rpmtsFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
if (fc <= 0) break;
@@ -1591,7 +1585,6 @@ assert(psm->mi == NULL);
psm->failedFile = _free(psm->failedFile);
fi->apath = _free(fi->apath);
- fi->fstates = _free(fi->fstates);
break;
case PSM_PKGINSTALL:
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index a2803b5e9..26159f79e 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1266,9 +1266,13 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
_hgfi(h, RPMTAG_FILEDEPENDSN, &td, scareFlags, fi->fddictn);
}
+ /* XXX States not needed by TR_REMOVED */
_hgfi(h, RPMTAG_FILESTATES, &td, defFlags, fi->fstates);
- if (fi->fstates == NULL)
- fi->fstates = xcalloc(fi->fc, sizeof(*fi->fstates));
+ if (fi->fstates == NULL) {
+ fi->fstates = xmalloc(sizeof(*fi->fstates) * fi->fc);
+ /* XXX means we show state "normal" when package not even installed */
+ memset(fi->fstates, RPMFILE_STATE_NORMAL, fi->fc);
+ }
_hgfi(h, RPMTAG_FILECAPS, &td, defFlags, fi->fcaps);