summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-03 21:21:12 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-03 21:21:12 +0000
commit0a3891d795831a44f7e086e8ef0936bf7e165c23 (patch)
treecdebfe38d133af529fd6eb24dd0501bfd33f850e
parent53db411bf5ed8f2d358db520afcbbb4cd970e805 (diff)
Memory-leak-in-error-path of the day in X509_ATTRIBUTE_set1_data().
ok logan@ beck@
-rw-r--r--lib/libssl/src/crypto/x509/x509_att.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libssl/src/crypto/x509/x509_att.c b/lib/libssl/src/crypto/x509/x509_att.c
index bbbeba50ac1..241464d9993 100644
--- a/lib/libssl/src/crypto/x509/x509_att.c
+++ b/lib/libssl/src/crypto/x509/x509_att.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_att.c,v 1.9 2014/06/28 18:25:24 logan Exp $ */
+/* $OpenBSD: x509_att.c,v 1.10 2014/07/03 21:21:11 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -304,7 +304,7 @@ int
X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data,
int len)
{
- ASN1_TYPE *ttmp;
+ ASN1_TYPE *ttmp = NULL;
ASN1_STRING *stmp = NULL;
int atype = 0;
@@ -350,6 +350,7 @@ X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data,
return 1;
err:
+ ASN1_TYPE_free(ttmp);
ASN1_STRING_free(stmp);
X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE);
return 0;