coverity 1462578 Resource leak
authorPauli <paul.dale@oracle.com>
Sun, 26 Apr 2020 23:26:48 +0000 (09:26 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 30 Apr 2020 10:21:33 +0000 (20:21 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11651)

crypto/cms/cms_sd.c

index a5342c4a00bc432750a48662289b83fdc3e8806d..264a4c9ba0632d59218f7e88e9a119666fb58d24 100644 (file)
@@ -950,8 +950,10 @@ int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
     ASN1_INTEGER *key = NULL;
     if (keysize > 0) {
         key = ASN1_INTEGER_new();
-        if (key == NULL || !ASN1_INTEGER_set(key, keysize))
+        if (key == NULL || !ASN1_INTEGER_set(key, keysize)) {
+            ASN1_INTEGER_free(key);
             return 0;
+        }
     }
     alg = X509_ALGOR_new();
     if (alg == NULL) {