Make sure fd bundle is always NULLed on rpmVerifySignatures() exit
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 25 Mar 2009 15:00:41 +0000 (17:00 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 25 Mar 2009 15:00:41 +0000 (17:00 +0200)
- readFile() failure could crash on double-free otherwise

lib/rpmchecksig.c

index 9680c5d..956afdd 100644 (file)
@@ -697,7 +697,6 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
     if (readFile(fd, fn, dig, plbundle, hdrbundle)) {
        goto exit;
     }
-    fdSetBundle(fd, NULL); /* XXX avoid double-free from fd close */
 
     rasprintf(&buf, "%s:%c", fn, (rpmIsVerbose() ? '\n' : ' ') );
 
@@ -776,6 +775,7 @@ exit:
     free(buf);
     rpmDigestBundleFree(hdrbundle);
     rpmDigestBundleFree(plbundle);
+    fdSetBundle(fd, NULL); /* XXX avoid double-free from fd close */
     sigh = rpmFreeSignature(sigh);
     hi = headerFreeIterator(hi);
     rpmKeyringFree(keyring);