summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormiod <>2014-07-03 21:21:11 +0000
committermiod <>2014-07-03 21:21:11 +0000
commitc80cb8a59eea6e7961fa8b2da1fa30572b67aa18 (patch)
tree80c879cbca0995c3e5dc5e5f36c4be714561415c /src/lib
parent1eb4693c0d21bfb3f64c533cd4e38c69feca287e (diff)
downloadopenbsd-c80cb8a59eea6e7961fa8b2da1fa30572b67aa18.tar.gz
openbsd-c80cb8a59eea6e7961fa8b2da1fa30572b67aa18.tar.bz2
openbsd-c80cb8a59eea6e7961fa8b2da1fa30572b67aa18.zip
Memory-leak-in-error-path of the day in X509_ATTRIBUTE_set1_data().
ok logan@ beck@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/x509_att.c5
-rw-r--r--src/lib/libssl/src/crypto/x509/x509_att.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_att.c b/src/lib/libcrypto/x509/x509_att.c
index bbbeba50ac..241464d999 100644
--- a/src/lib/libcrypto/x509/x509_att.c
+++ b/src/lib/libcrypto/x509/x509_att.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_att.c,v 1.9 2014/06/28 18:25:24 logan Exp $ */ 1/* $OpenBSD: x509_att.c,v 1.10 2014/07/03 21:21:11 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -304,7 +304,7 @@ int
304X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, 304X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data,
305 int len) 305 int len)
306{ 306{
307 ASN1_TYPE *ttmp; 307 ASN1_TYPE *ttmp = NULL;
308 ASN1_STRING *stmp = NULL; 308 ASN1_STRING *stmp = NULL;
309 int atype = 0; 309 int atype = 0;
310 310
@@ -350,6 +350,7 @@ X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data,
350 return 1; 350 return 1;
351 351
352err: 352err:
353 ASN1_TYPE_free(ttmp);
353 ASN1_STRING_free(stmp); 354 ASN1_STRING_free(stmp);
354 X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE); 355 X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE);
355 return 0; 356 return 0;
diff --git a/src/lib/libssl/src/crypto/x509/x509_att.c b/src/lib/libssl/src/crypto/x509/x509_att.c
index bbbeba50ac..241464d999 100644
--- a/src/lib/libssl/src/crypto/x509/x509_att.c
+++ b/src/lib/libssl/src/crypto/x509/x509_att.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_att.c,v 1.9 2014/06/28 18:25:24 logan Exp $ */ 1/* $OpenBSD: x509_att.c,v 1.10 2014/07/03 21:21:11 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -304,7 +304,7 @@ int
304X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, 304X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data,
305 int len) 305 int len)
306{ 306{
307 ASN1_TYPE *ttmp; 307 ASN1_TYPE *ttmp = NULL;
308 ASN1_STRING *stmp = NULL; 308 ASN1_STRING *stmp = NULL;
309 int atype = 0; 309 int atype = 0;
310 310
@@ -350,6 +350,7 @@ X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data,
350 return 1; 350 return 1;
351 351
352err: 352err:
353 ASN1_TYPE_free(ttmp);
353 ASN1_STRING_free(stmp); 354 ASN1_STRING_free(stmp);
354 X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE); 355 X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE);
355 return 0; 356 return 0;