summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/ameth_lib.c
diff options
context:
space:
mode:
authormiod <>2014-07-11 13:41:59 +0000
committermiod <>2014-07-11 13:41:59 +0000
commit9b099cfe9b8ff48ebf73f26baf1ffb356d3ab825 (patch)
tree65ce624e7f28ec877580f132bc7d476d3991df23 /src/lib/libcrypto/asn1/ameth_lib.c
parent348e81746631673e88ea126c2a95493cd916977a (diff)
downloadopenbsd-9b099cfe9b8ff48ebf73f26baf1ffb356d3ab825.tar.gz
openbsd-9b099cfe9b8ff48ebf73f26baf1ffb356d3ab825.tar.bz2
openbsd-9b099cfe9b8ff48ebf73f26baf1ffb356d3ab825.zip
More memory leaks and unchecked allocations; OpenSSL PR #3403 via OpenSSL
trunk. (note we had already fixed some of the issues in that PR independently)
Diffstat (limited to 'src/lib/libcrypto/asn1/ameth_lib.c')
-rw-r--r--src/lib/libcrypto/asn1/ameth_lib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c
index 8701e97337..e9f73cb3a6 100644
--- a/src/lib/libcrypto/asn1/ameth_lib.c
+++ b/src/lib/libcrypto/asn1/ameth_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ameth_lib.c,v 1.12 2014/07/11 08:44:47 jsing Exp $ */ 1/* $OpenBSD: ameth_lib.c,v 1.13 2014/07/11 13:41:59 miod 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 */
@@ -242,11 +242,16 @@ int
242EVP_PKEY_asn1_add_alias(int to, int from) 242EVP_PKEY_asn1_add_alias(int to, int from)
243{ 243{
244 EVP_PKEY_ASN1_METHOD *ameth; 244 EVP_PKEY_ASN1_METHOD *ameth;
245
245 ameth = EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL); 246 ameth = EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL);
246 if (!ameth) 247 if (!ameth)
247 return 0; 248 return 0;
248 ameth->pkey_base_id = to; 249 ameth->pkey_base_id = to;
249 return EVP_PKEY_asn1_add0(ameth); 250 if (!EVP_PKEY_asn1_add0(ameth)) {
251 EVP_PKEY_asn1_free(ameth);
252 return 0;
253 }
254 return 1;
250} 255}
251 256
252int 257int