Don't ignore (!) reference count in X509_STORE_free.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 19 Jul 2012 12:48:02 +0000 (12:48 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 19 Jul 2012 12:48:02 +0000 (12:48 +0000)
crypto/x509/x509_lu.c

index 38525a8cddbc267c8e2c7a78c354438bb609c85a..72121f6beca8630bacb56e8e0ea733ac767ea773 100644 (file)
@@ -238,6 +238,19 @@ void X509_STORE_free(X509_STORE *vfy)
        if (vfy == NULL)
            return;
 
+       i=CRYPTO_add(&vfy->references,-1,CRYPTO_LOCK_X509_STORE);
+#ifdef REF_PRINT
+       REF_PRINT("X509_STORE",vfy);
+#endif
+       if (i > 0) return;
+#ifdef REF_CHECK
+       if (i < 0)
+               {
+               fprintf(stderr,"X509_STORE_free, bad reference count\n");
+               abort(); /* ok */
+               }
+#endif
+
        sk=vfy->get_cert_methods;
        for (i=0; i<sk_X509_LOOKUP_num(sk); i++)
                {