From 86b5c818e0f58d589d9e8955a2b34062abfb521a Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 31 May 2011 12:43:15 +0300 Subject: [PATCH] Remove reamining dead assignments from rpmtsiFree() in transaction code - Not all of these are at the end of local scope and in many cases the iterator pointer is reused, but the logic in all these is straightforward enough (no jumps etc) that there's no much chance of mistakenly using already freed iterator. --- lib/depends.c | 4 ++-- lib/order.c | 4 ++-- lib/rpmts.c | 2 +- lib/transaction.c | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/depends.c b/lib/depends.c index 75b299b..2b84bd3 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -561,7 +561,7 @@ int rpmtsCheck(rpmts ts) /* Check package name (not provides!) against installed obsoletes */ checkInstDeps(ts, dcache, p, RPMTAG_OBSOLETENAME, rpmteN(p)); } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); /* * Look at the removed packages and make sure they aren't critical. @@ -583,7 +583,7 @@ int rpmtsCheck(rpmts ts) checkInstDeps(ts, dcache, p, RPMTAG_REQUIRENAME, rpmfiFN(fi)); } } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); exit: depCacheFree(dcache); diff --git a/lib/order.c b/lib/order.c index 28284d4..0dc50b7 100644 --- a/lib/order.c +++ b/lib/order.c @@ -557,7 +557,7 @@ int rpmtsOrder(rpmts ts) while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) { rpmalAdd(erasedPackages, p); } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); for (int i = 0; i < nelem; i++) { sortInfo[i].te = tsmem->order[i]; @@ -587,7 +587,7 @@ int rpmtsOrder(rpmts ts) } seenColls = argvFree(seenColls); - pi = rpmtsiFree(pi); + rpmtsiFree(pi); newOrder = xcalloc(tsmem->orderCount, sizeof(*newOrder)); SCCs = detectSCCs(sortInfo, nelem, (rpmtsFlags(ts) & RPMTRANS_FLAG_DEPLOOPS)); diff --git a/lib/rpmts.c b/lib/rpmts.c index cf82ac7..cb9e00d 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -529,7 +529,7 @@ void rpmtsClean(rpmts ts) pi = rpmtsiInit(ts); while ((p = rpmtsiNext(pi, 0)) != NULL) rpmteCleanDS(p); - pi = rpmtsiFree(pi); + rpmtsiFree(pi); tsmem->addedPackages = rpmalFree(tsmem->addedPackages); diff --git a/lib/transaction.c b/lib/transaction.c index a6794e4..6090f2c 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1154,7 +1154,7 @@ static int rpmtsSetupCollections(rpmts ts) } } } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); /* we've looked at all the rpmte's, update the lastInCollectionAny lists */ for (i = 0; i < numSeenPost; i++) { @@ -1210,7 +1210,7 @@ static void addFingerprints(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPr (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), rpmfiFC(fi)); } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); /* =============================================== * Check fingerprints if they contain symlinks @@ -1230,7 +1230,7 @@ static void addFingerprints(rpmts ts, uint64_t fileCount, rpmFpHash ht, fingerPr } (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); rpmFpHashFree(symlinks); } @@ -1310,7 +1310,7 @@ static int rpmtsPrepare(rpmts ts) skipEraseFiles(ts, p); } } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); /* Open rpmdb & enter chroot for fingerprinting if necessary */ if (rpmdbOpenAll(ts->rdb) || rpmChrootIn()) { @@ -1343,7 +1343,7 @@ static int rpmtsPrepare(rpmts ts) } (void) rpmswExit(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); rpmtsNotify(ts, NULL, RPMCALLBACK_TRANS_STOP, 6, tsmem->orderCount); /* return from chroot if done earlier */ @@ -1355,7 +1355,7 @@ static int rpmtsPrepare(rpmts ts) while ((p = rpmtsiNext(pi, 0)) != NULL) { rpmteSetFI(p, NULL); } - pi = rpmtsiFree(pi); + rpmtsiFree(pi); exit: rpmFpHashFree(ht); -- 2.7.4