Coverity 1453634: Resource leaks (RESOURCE_LEAK)
authorPauli <paul.dale@oracle.com>
Sun, 8 Sep 2019 08:39:11 +0000 (18:39 +1000)
committerPauli <paul.dale@oracle.com>
Tue, 10 Sep 2019 22:27:27 +0000 (08:27 +1000)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)

providers/common/macs/kmac_prov.c

index 53598418dbad722baed8c8c9049c11d9f4769396..99bcbf7da99e1e103a77e2d7fc50e94bcb1cad0e 100644 (file)
@@ -174,8 +174,10 @@ static void *kmac_fetch_new(void *provctx, const OSSL_PARAM *params)
     if (kctx == NULL)
         return 0;
     if (!ossl_prov_digest_load_from_params(&kctx->digest, params,
-                                      PROV_LIBRARY_CONTEXT_OF(provctx)))
+                                      PROV_LIBRARY_CONTEXT_OF(provctx))) {
+        kmac_free(kctx);
         return 0;
+    }
 
     kctx->out_len = EVP_MD_size(ossl_prov_digest_md(&kctx->digest));
     return kctx;