CID 1442836: Resource leaks
authorPauli <paul.dale@oracle.com>
Sun, 24 Feb 2019 11:26:20 +0000 (21:26 +1000)
committerPauli <paul.dale@oracle.com>
Sun, 24 Feb 2019 11:26:20 +0000 (21:26 +1000)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/8318)

crypto/property/property.c

index dea0dfd66da4507bfaaedd9f5fce6e1400b75051..e4fdc68c4a5e50d4055fdc1c851fa18fe42e3c08 100644 (file)
@@ -143,11 +143,12 @@ static void alg_cleanup(size_t idx, ALGORITHM *a)
 
 OSSL_METHOD_STORE *ossl_method_store_new(void)
 {
-    OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));
+    OSSL_METHOD_STORE *res;
 
     if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))
         return 0;
 
+    res = OPENSSL_zalloc(sizeof(*res));
     if (res != NULL) {
         if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL) {
             OPENSSL_free(res);