diff options
author | 2015-02-14 15:08:37 +0000 | |
---|---|---|
committer | 2015-02-14 15:08:37 +0000 | |
commit | b7e347b4d11a7bc12ed66d91a0d3f16c458048a1 (patch) | |
tree | 57f910e072dbc642861123e6914c3ea18452fcca /lib/libssl/src | |
parent | Fix tests that got incorrectly inverted with the BN_CTX_get() return check (diff) | |
download | wireguard-openbsd-b7e347b4d11a7bc12ed66d91a0d3f16c458048a1.tar.xz wireguard-openbsd-b7e347b4d11a7bc12ed66d91a0d3f16c458048a1.zip |
Memory leaks upon error. Coverity CID 78874.
ok jsing@
Diffstat (limited to 'lib/libssl/src')
-rw-r--r-- | lib/libssl/src/crypto/gost/gostr341001_pmeth.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libssl/src/crypto/gost/gostr341001_pmeth.c b/lib/libssl/src/crypto/gost/gostr341001_pmeth.c index a297587c62b..1454f3f0a2b 100644 --- a/lib/libssl/src/crypto/gost/gostr341001_pmeth.c +++ b/lib/libssl/src/crypto/gost/gostr341001_pmeth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341001_pmeth.c,v 1.11 2015/02/14 06:40:04 jsing Exp $ */ +/* $OpenBSD: gostr341001_pmeth.c,v 1.12 2015/02/14 15:08:37 miod Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> * Copyright (c) 2005-2006 Cryptocom LTD @@ -184,9 +184,9 @@ static int pkey_gost01_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) { struct gost_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx); - EC_GROUP *group; - GOST_KEY *gost; - int ret; + EC_GROUP *group = NULL; + GOST_KEY *gost = NULL; + int ret = 0; if (data->sign_param_nid == NID_undef || data->digest_nid == NID_undef) { @@ -196,23 +196,23 @@ pkey_gost01_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) group = EC_GROUP_new_by_curve_name(data->sign_param_nid); if (group == NULL) - return 0; + goto done; EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE); gost = GOST_KEY_new(); if (gost == NULL) - return 0; + goto done; if (GOST_KEY_set_digest(gost, data->digest_nid) == 0) - return 0; + goto done; - ret = GOST_KEY_set_group(gost, group); - if (ret != 0) + if (GOST_KEY_set_group(gost, group) != 0) ret = EVP_PKEY_assign_GOST(pkey, gost); + +done: if (ret == 0) GOST_KEY_free(gost); - EC_GROUP_free(group); return ret; } |