diff options
| author | tb <> | 2024-05-10 05:12:03 +0000 |
|---|---|---|
| committer | tb <> | 2024-05-10 05:12:03 +0000 |
| commit | 3414111837d188fbb11c07116d68afa352a5deac (patch) | |
| tree | 5a5c3afe61dee8a45a69e29a0b1711621d79880b /src | |
| parent | fadf444697d647a8b122bdc967653df5d43b5c0f (diff) | |
| download | openbsd-3414111837d188fbb11c07116d68afa352a5deac.tar.gz openbsd-3414111837d188fbb11c07116d68afa352a5deac.tar.bz2 openbsd-3414111837d188fbb11c07116d68afa352a5deac.zip | |
Add missing EC_KEY_free()
While eckey_from_explicit_params() frees *out_eckey, eckey_from_object()
and eckey_from_params() do not. These functions are currently all callled
with a NULL *out_eckey, but the latter two would leak if that should ever
change.
ok jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 7b2bad45b4..378261b946 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_ameth.c,v 1.67 2024/04/18 11:56:53 tb Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.68 2024/05/10 05:12:03 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -173,6 +173,7 @@ eckey_from_object(const ASN1_OBJECT *aobj, EC_KEY **out_eckey) | |||
| 173 | { | 173 | { |
| 174 | int nid; | 174 | int nid; |
| 175 | 175 | ||
| 176 | EC_KEY_free(*out_eckey); | ||
| 176 | *out_eckey = NULL; | 177 | *out_eckey = NULL; |
| 177 | 178 | ||
| 178 | if ((nid = OBJ_obj2nid(aobj)) == NID_undef) | 179 | if ((nid = OBJ_obj2nid(aobj)) == NID_undef) |
| @@ -206,6 +207,7 @@ eckey_to_params(EC_KEY *eckey, int *out_type, void **out_val) | |||
| 206 | static int | 207 | static int |
| 207 | eckey_from_params(int ptype, const void *pval, EC_KEY **out_eckey) | 208 | eckey_from_params(int ptype, const void *pval, EC_KEY **out_eckey) |
| 208 | { | 209 | { |
| 210 | EC_KEY_free(*out_eckey); | ||
| 209 | *out_eckey = NULL; | 211 | *out_eckey = NULL; |
| 210 | 212 | ||
| 211 | if (ptype == V_ASN1_SEQUENCE) | 213 | if (ptype == V_ASN1_SEQUENCE) |
