ignatenkobrain / rpms / nginx

Forked from rpms/nginx 2 years ago
Clone
0bbbd2
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
0bbbd2
index 7be4fb4..ab3865a 100644
0bbbd2
--- a/src/event/ngx_event_openssl.c
0bbbd2
+++ b/src/event/ngx_event_openssl.c
0bbbd2
@@ -727,16 +727,24 @@ ngx_ssl_load_certificate_key(ngx_pool_t *pool, char **err,
0bbbd2
             return NULL;
0bbbd2
         }
0bbbd2
 
0bbbd2
+        if (!ENGINE_init(engine)) {
0bbbd2
+            *err = "ENGINE_init() failed";
0bbbd2
+            ENGINE_free(engine);
0bbbd2
+            return NULL;
0bbbd2
+        }
0bbbd2
+
0bbbd2
         *last++ = ':';
0bbbd2
 
0bbbd2
         pkey = ENGINE_load_private_key(engine, (char *) last, 0, 0);
0bbbd2
 
0bbbd2
         if (pkey == NULL) {
0bbbd2
             *err = "ENGINE_load_private_key() failed";
0bbbd2
+            ENGINE_finish(engine);
0bbbd2
             ENGINE_free(engine);
0bbbd2
             return NULL;
0bbbd2
         }
0bbbd2
 
0bbbd2
+        ENGINE_finish(engine);
0bbbd2
         ENGINE_free(engine);
0bbbd2
 
0bbbd2
         return pkey;