ignatenkobrain / rpms / nginx

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