From b0f6402bf41a66ebfa13e98bb96763d01bb27d2f Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 10 May 2021 10:17:38 +1000 Subject: [PATCH] coverity: fix 1484539 resource leak Reviewed-by: Shane Lontis Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/15208) --- apps/kdf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/kdf.c b/apps/kdf.c index 7b016051f1f..c4892ed20ec 100644 --- a/apps/kdf.c +++ b/apps/kdf.c @@ -52,13 +52,14 @@ static char *alloc_kdf_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; -- 2.47.3