From 9b099cfe9b8ff48ebf73f26baf1ffb356d3ab825 Mon Sep 17 00:00:00 2001 From: miod <> Date: Fri, 11 Jul 2014 13:41:59 +0000 Subject: 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) --- src/lib/libcrypto/asn1/ameth_lib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/lib/libcrypto/asn1/ameth_lib.c') 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 @@ -/* $OpenBSD: ameth_lib.c,v 1.12 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: ameth_lib.c,v 1.13 2014/07/11 13:41:59 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -242,11 +242,16 @@ int EVP_PKEY_asn1_add_alias(int to, int from) { EVP_PKEY_ASN1_METHOD *ameth; + ameth = EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL); if (!ameth) return 0; ameth->pkey_base_id = to; - return EVP_PKEY_asn1_add0(ameth); + if (!EVP_PKEY_asn1_add0(ameth)) { + EVP_PKEY_asn1_free(ameth); + return 0; + } + return 1; } int -- cgit v1.2.3-55-g6feb