diff options
| author | miod <> | 2014-07-03 21:21:11 +0000 |
|---|---|---|
| committer | miod <> | 2014-07-03 21:21:11 +0000 |
| commit | 6dec45ab9de98274c8d5384a638d1e051865ab6c (patch) | |
| tree | 80c879cbca0995c3e5dc5e5f36c4be714561415c | |
| parent | d3de750616a73f301988f861466e4ad06a6760cb (diff) | |
| download | openbsd-6dec45ab9de98274c8d5384a638d1e051865ab6c.tar.gz openbsd-6dec45ab9de98274c8d5384a638d1e051865ab6c.tar.bz2 openbsd-6dec45ab9de98274c8d5384a638d1e051865ab6c.zip | |
Memory-leak-in-error-path of the day in X509_ATTRIBUTE_set1_data().
ok logan@ beck@
| -rw-r--r-- | src/lib/libcrypto/x509/x509_att.c | 5 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/x509/x509_att.c | 5 |
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 | |||
| 304 | X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, | 304 | X509_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 | ||
| 352 | err: | 352 | err: |
| 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 | |||
| 304 | X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, | 304 | X509_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 | ||
| 352 | err: | 352 | err: |
| 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; |
