diff options
| author | tobhe <> | 2022-11-10 12:37:00 +0000 |
|---|---|---|
| committer | tobhe <> | 2022-11-10 12:37:00 +0000 |
| commit | 76fc0c1130db1fe7c3d20b66da51f81aa0fdf89c (patch) | |
| tree | 0e7c13bf24eb44de4251378b332c445a5ccb65c0 /src/lib/libcrypto/dsa/dsa_prn.c | |
| parent | f85002989ed461d22560ad5956ab25e03b062d32 (diff) | |
| download | openbsd-76fc0c1130db1fe7c3d20b66da51f81aa0fdf89c.tar.gz openbsd-76fc0c1130db1fe7c3d20b66da51f81aa0fdf89c.tar.bz2 openbsd-76fc0c1130db1fe7c3d20b66da51f81aa0fdf89c.zip | |
Fix a few more leaks in *_print() functions.
ok jsing@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_prn.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_prn.c b/src/lib/libcrypto/dsa/dsa_prn.c index a26f3cfc6a..a2063283ea 100644 --- a/src/lib/libcrypto/dsa/dsa_prn.c +++ b/src/lib/libcrypto/dsa/dsa_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_prn.c,v 1.7 2022/11/08 19:17:05 tobhe Exp $ */ | 1 | /* $OpenBSD: dsa_prn.c,v 1.8 2022/11/10 12:37:00 tobhe 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 | */ |
| @@ -116,12 +116,16 @@ int | |||
| 116 | DSAparams_print(BIO *bp, const DSA *x) | 116 | DSAparams_print(BIO *bp, const DSA *x) |
| 117 | { | 117 | { |
| 118 | EVP_PKEY *pk; | 118 | EVP_PKEY *pk; |
| 119 | int ret; | 119 | int ret = 0; |
| 120 | |||
| 121 | if ((pk = EVP_PKEY_new()) == NULL) | ||
| 122 | goto err; | ||
| 123 | |||
| 124 | if (!EVP_PKEY_set1_DSA(pk, (DSA *)x)) | ||
| 125 | goto err; | ||
| 120 | 126 | ||
| 121 | pk = EVP_PKEY_new(); | ||
| 122 | if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x)) | ||
| 123 | return 0; | ||
| 124 | ret = EVP_PKEY_print_params(bp, pk, 4, NULL); | 127 | ret = EVP_PKEY_print_params(bp, pk, 4, NULL); |
| 128 | err: | ||
| 125 | EVP_PKEY_free(pk); | 129 | EVP_PKEY_free(pk); |
| 126 | return ret; | 130 | return ret; |
| 127 | } | 131 | } |
