From 2e29794f8c2a572c0c06848c618c9e9d69d69ddb Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 28 Dec 2023 21:49:07 +0000 Subject: [PATCH] Fix another EVP_PKEY_assign_GOST() call Again this can't actually fail, but if it did, things would leak. Call GOST_KEY_free() in the error path. ok jsing CID 471706 (false positive) --- lib/libcrypto/gost/gostr341001_ameth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/gost/gostr341001_ameth.c b/lib/libcrypto/gost/gostr341001_ameth.c index 9ef7cdf461e..9098797adec 100644 --- a/lib/libcrypto/gost/gostr341001_ameth.c +++ b/lib/libcrypto/gost/gostr341001_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341001_ameth.c,v 1.20 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gostr341001_ameth.c,v 1.21 2023/12/28 21:49:07 tb Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -101,8 +101,10 @@ decode_gost01_algor_params(EVP_PKEY *pkey, const unsigned char **p, int len) GOSTerror(ERR_R_MALLOC_FAILURE); return 0; } - if (EVP_PKEY_assign_GOST(pkey, ec) == 0) + if (EVP_PKEY_assign_GOST(pkey, ec) == 0) { + GOST_KEY_free(ec); return 0; + } } group = EC_GROUP_new_by_curve_name(param_nid); -- 2.20.1