Stop library before checking for mem leaks
authorMatt Caswell <matt@openssl.org>
Tue, 9 Feb 2016 22:09:56 +0000 (22:09 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 9 Feb 2016 23:29:31 +0000 (23:29 +0000)
With the new init framework resources aren't released until the process
exits. This means checking for mem leaks before that point finds a lot of
things! We should explicitly close down the library if we're checking for
mem leaks.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/mem_dbg.c

index 05590442d14f4d4643d5c27c18557e438acab8d2..c3d98caec92b225d69d8e24456fac2c28e56ebb4 100644 (file)
@@ -639,6 +639,9 @@ int CRYPTO_mem_leaks(BIO *b)
     if (mh == NULL && amih == NULL)
         return 1;
 
+    /* Ensure all resources are released */
+    OPENSSL_INIT_library_stop();
+
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
 
     ml.bio = b;