summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ec
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2015-03-20 03:02:52 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2015-03-20 03:02:52 +0000
commitf9ba44407dbe37219368ddc1c8d7f1bf55021a10 (patch)
tree5e45da16bd1f7ea11cd08c764a740ccef07abb99 /lib/libcrypto/ec
parent836b495106f594955b58752d134d1fdfdc8973b1 (diff)
Fix a memory leak in an error path.
From OpenSSL commit 5e5d53d341fd9a9b9cc0a58eb3690832ca7a511f. ok guenther@, logan@
Diffstat (limited to 'lib/libcrypto/ec')
-rw-r--r--lib/libcrypto/ec/ec_asn1.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c
index f01008ec438..e1d3f6bad7d 100644
--- a/lib/libcrypto/ec/ec_asn1.c
+++ b/lib/libcrypto/ec/ec_asn1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec_asn1.c,v 1.13 2015/03/19 14:00:22 tedu Exp $ */
+/* $OpenBSD: ec_asn1.c,v 1.14 2015/03/20 03:02:51 doug Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
@@ -1235,6 +1235,8 @@ d2i_ECParameters(EC_KEY ** a, const unsigned char **in, long len)
if (!d2i_ECPKParameters(&ret->group, in, len)) {
ECerr(EC_F_D2I_ECPARAMETERS, ERR_R_EC_LIB);
+ if (a == NULL || *a != ret)
+ EC_KEY_free(ret);
return NULL;
}