diff options
author | 2014-07-03 21:21:11 +0000 | |
---|---|---|
committer | 2014-07-03 21:21:11 +0000 | |
commit | 37a25d80b04984bc08bb4431af6b7f537f0510d8 (patch) | |
tree | f7ffcb4f577a88c483451d73d990837e02f3d586 | |
parent | Add identcpu detection for 1-GByte pages (diff) | |
download | wireguard-openbsd-37a25d80b04984bc08bb4431af6b7f537f0510d8.tar.xz wireguard-openbsd-37a25d80b04984bc08bb4431af6b7f537f0510d8.zip |
Memory-leak-in-error-path of the day in X509_ATTRIBUTE_set1_data().
ok logan@ beck@
-rw-r--r-- | lib/libcrypto/x509/x509_att.c | 5 | ||||
-rw-r--r-- | lib/libssl/src/crypto/x509/x509_att.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/libcrypto/x509/x509_att.c b/lib/libcrypto/x509/x509_att.c index bbbeba50ac1..241464d9993 100644 --- a/lib/libcrypto/x509/x509_att.c +++ b/lib/libcrypto/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; 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; |