Fix memory leak reporting.
[openssl.git] / apps / openssl.c
index b19628571b09011d204d1ac5941abe78952be5b7..e070a444a5b9472004ba610bf65e26bc0dbef13d 100644 (file)
@@ -301,12 +301,7 @@ int main(int Argc, char *ARGV[])
     }
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
-#if 0
-    if (getenv("OPENSSL_DEBUG_LOCKING") != NULL)
-#endif
-    {
-        CRYPTO_set_locking_callback(lock_dbg_cb);
-    }
+    CRYPTO_set_locking_callback(lock_dbg_cb);
 
     if (getenv("OPENSSL_FIPS")) {
 #ifdef OPENSSL_FIPS
@@ -428,10 +423,6 @@ int main(int Argc, char *ARGV[])
     if (arg.data != NULL)
         OPENSSL_free(arg.data);
 
-    if (bio_err != NULL) {
-        BIO_free(bio_err);
-        bio_err = NULL;
-    }
 #if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
     /* Free any duplicate Argv[] storage. */
     if (free_Argv) {
@@ -440,6 +431,10 @@ int main(int Argc, char *ARGV[])
 #endif
     apps_shutdown();
     CRYPTO_mem_leaks(bio_err);
+    if (bio_err != NULL) {
+        BIO_free(bio_err);
+        bio_err = NULL;
+    }
 
     OPENSSL_EXIT(ret);
 }