ignatenkobrain / rpms / nginx

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