Skip to content

Commit

Permalink
Fix a possible memleak in cms_main
Browse files Browse the repository at this point in the history
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #22918)

(cherry picked from commit 3457a55)
  • Loading branch information
bernd-edlinger authored and t8m committed Dec 12, 2023
1 parent ed5f9ce commit dfe3207
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/cms.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,8 @@ int cms_main(int argc, char **argv)
"recipient certificate file");
if (cert == NULL)
goto end;
sk_X509_push(encerts, cert);
if (!sk_X509_push(encerts, cert))
goto end;
cert = NULL;
} else {
recipfile = opt_arg();
Expand Down Expand Up @@ -831,7 +832,8 @@ int cms_main(int argc, char **argv)
"recipient certificate file");
if (cert == NULL)
goto end;
sk_X509_push(encerts, cert);
if (!sk_X509_push(encerts, cert))
goto end;
cert = NULL;
}
}
Expand Down

0 comments on commit dfe3207

Please sign in to comment.