From c0a6f7b14169adb0f3961f6ccda8ca49eb87fead Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 5 Nov 2008 14:10:16 +0200 Subject: Stop messing with fi->fstates allocations in psm - it's alloced and freed by rpmfiNew()/Free() always anyway --- lib/psm.c | 7 ------- lib/rpmfi.c | 8 ++++++-- 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); -- cgit v1.2.3