Eliminate broken "can't happen" early return
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 13 Sep 2010 11:05:02 +0000 (14:05 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 13 Sep 2010 11:08:49 +0000 (14:08 +0300)
- Opening RPMDBI_PACKAGES should indeed never fail, but if it does
  this would return way too early, leaking memory and references
  left and right. Also the dbi is rarely used for anything, only
  the rewrite mode used by markReplacedFiles() needs it, dbi
  is actually unused on dbiCclose()

lib/rpmdb.c

index 211a289..6b09e70 100644 (file)
@@ -1255,8 +1255,6 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
     }
 
     dbi = rpmdbOpenIndex(mi->mi_db, RPMDBI_PACKAGES, 0);
-    if (dbi == NULL)   /* XXX can't happen */
-       return NULL;
 
     xx = miFreeHeader(mi, dbi);