]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/init.c
init: fix defined but unused warning/error
[thirdparty/openssl.git] / crypto / init.c
index 5c5985fc426c2ae05fb48753920c45d8a085f8a1..ed6a6bb084e11f877bf81a640783d8740eaee9ba 100644 (file)
@@ -650,28 +650,26 @@ int OPENSSL_atexit(void (*handler)(void))
 #if !defined(OPENSSL_USE_NODELETE)\
     && !defined(OPENSSL_NO_PINSHARED)
     {
+# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
+        HMODULE handle = NULL;
+        BOOL ret;
         union {
             void *sym;
             void (*func)(void);
         } handlersym;
 
         handlersym.func = handler;
-# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
-        {
-            HMODULE handle = NULL;
-            BOOL ret;
-
-            /*
-             * We don't use the DSO route for WIN32 because there is a better
-             * way
-             */
-            ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
-                                    | GET_MODULE_HANDLE_EX_FLAG_PIN,
-                                    handlersym.sym, &handle);
-
-            if (!ret)
-                return 0;
-        }
+
+        /*
+         * We don't use the DSO route for WIN32 because there is a better
+         * way
+         */
+        ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
+                                | GET_MODULE_HANDLE_EX_FLAG_PIN,
+                                handlersym.sym, &handle);
+
+        if (!ret)
+            return 0;
 # elif !defined(DSO_NONE)
         /*
          * Deliberately leak a reference to the handler. This will force the
@@ -679,18 +677,22 @@ int OPENSSL_atexit(void (*handler)(void))
          * atexit handler. If -znodelete has been used then this is
          * unnecessary.
          */
-        {
-            DSO *dso = NULL;
-
-            ERR_set_mark();
-            dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE);
-            /* See same code above in ossl_init_base() for an explanation. */
-            OSSL_TRACE1(INIT,
-                       "atexit: obtained DSO reference? %s\n",
-                       (dso == NULL ? "No!" : "Yes."));
-            DSO_free(dso);
-            ERR_pop_to_mark();
-        }
+        DSO *dso = NULL;
+        union {
+            void *sym;
+            void (*func)(void);
+        } handlersym;
+
+        handlersym.func = handler;
+
+        ERR_set_mark();
+        dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE);
+        /* See same code above in ossl_init_base() for an explanation. */
+        OSSL_TRACE1(INIT,
+                   "atexit: obtained DSO reference? %s\n",
+                   (dso == NULL ? "No!" : "Yes."));
+        DSO_free(dso);
+        ERR_pop_to_mark();
 # endif
     }
 #endif