summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-05-10 10:18:07 +1000
committerPauli <pauli@openssl.org>2021-05-12 11:11:53 +1000
commit54e1c14a29ef338a60ef180e213ffaeb3010f798 (patch)
tree5822ed6bb0efd9cac7a5d3de628dbcc89376eb20
parentb0f6402bf41a66ebfa13e98bb96763d01bb27d2f (diff)
coverity: fix 1484540 resource leak
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/15208)
-rw-r--r--apps/mac.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/mac.c b/apps/mac.c
index ca02a781e5..5f80ca22c7 100644
--- a/apps/mac.c
+++ b/apps/mac.c
@@ -56,13 +56,14 @@ static char *alloc_mac_algorithm_name(STACK_OF(OPENSSL_STRING) **optp,
const char *name, const char *arg)
{
size_t len = strlen(name) + strlen(arg) + 2;
- char *res = app_malloc(len, "algorithm name");
+ char *res;
if (*optp == NULL)
*optp = sk_OPENSSL_STRING_new_null();
if (*optp == NULL)
return NULL;
+ res = app_malloc(len, "algorithm name");
BIO_snprintf(res, len, "%s:%s", name, arg);
if (sk_OPENSSL_STRING_push(*optp, res))
return res;