diff options
-rw-r--r-- | src/lib/libcrypto/x509v3/v3_purp.c | 11 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/x509v3/v3_purp.c | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index de41a51914..67fb7baa3e 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: v3_purp.c,v 1.17 2014/06/12 15:49:31 deraadt Exp $ */ | 1 | /* $OpenBSD: v3_purp.c,v 1.18 2014/06/28 18:14:57 logan Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2001. | 3 | * project 2001. |
4 | */ | 4 | */ |
@@ -226,6 +226,9 @@ X509_PURPOSE_add(int id, int trust, int flags, | |||
226 | ptmp->name = BUF_strdup(name); | 226 | ptmp->name = BUF_strdup(name); |
227 | ptmp->sname = BUF_strdup(sname); | 227 | ptmp->sname = BUF_strdup(sname); |
228 | if (!ptmp->name || !ptmp->sname) { | 228 | if (!ptmp->name || !ptmp->sname) { |
229 | free(ptmp->name); | ||
230 | free(ptmp->sname); | ||
231 | free(ptmp); | ||
229 | X509V3err(X509V3_F_X509_PURPOSE_ADD, ERR_R_MALLOC_FAILURE); | 232 | X509V3err(X509V3_F_X509_PURPOSE_ADD, ERR_R_MALLOC_FAILURE); |
230 | return 0; | 233 | return 0; |
231 | } | 234 | } |
@@ -242,11 +245,17 @@ X509_PURPOSE_add(int id, int trust, int flags, | |||
242 | /* If its a new entry manage the dynamic table */ | 245 | /* If its a new entry manage the dynamic table */ |
243 | if (idx == -1) { | 246 | if (idx == -1) { |
244 | if (!xptable && !(xptable = sk_X509_PURPOSE_new(xp_cmp))) { | 247 | if (!xptable && !(xptable = sk_X509_PURPOSE_new(xp_cmp))) { |
248 | free(ptmp->name); | ||
249 | free(ptmp->sname); | ||
250 | free(ptmp); | ||
245 | X509V3err(X509V3_F_X509_PURPOSE_ADD, | 251 | X509V3err(X509V3_F_X509_PURPOSE_ADD, |
246 | ERR_R_MALLOC_FAILURE); | 252 | ERR_R_MALLOC_FAILURE); |
247 | return 0; | 253 | return 0; |
248 | } | 254 | } |
249 | if (!sk_X509_PURPOSE_push(xptable, ptmp)) { | 255 | if (!sk_X509_PURPOSE_push(xptable, ptmp)) { |
256 | free(ptmp->name); | ||
257 | free(ptmp->sname); | ||
258 | free(ptmp); | ||
250 | X509V3err(X509V3_F_X509_PURPOSE_ADD, | 259 | X509V3err(X509V3_F_X509_PURPOSE_ADD, |
251 | ERR_R_MALLOC_FAILURE); | 260 | ERR_R_MALLOC_FAILURE); |
252 | return 0; | 261 | return 0; |
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_purp.c b/src/lib/libssl/src/crypto/x509v3/v3_purp.c index de41a51914..67fb7baa3e 100644 --- a/src/lib/libssl/src/crypto/x509v3/v3_purp.c +++ b/src/lib/libssl/src/crypto/x509v3/v3_purp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: v3_purp.c,v 1.17 2014/06/12 15:49:31 deraadt Exp $ */ | 1 | /* $OpenBSD: v3_purp.c,v 1.18 2014/06/28 18:14:57 logan Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2001. | 3 | * project 2001. |
4 | */ | 4 | */ |
@@ -226,6 +226,9 @@ X509_PURPOSE_add(int id, int trust, int flags, | |||
226 | ptmp->name = BUF_strdup(name); | 226 | ptmp->name = BUF_strdup(name); |
227 | ptmp->sname = BUF_strdup(sname); | 227 | ptmp->sname = BUF_strdup(sname); |
228 | if (!ptmp->name || !ptmp->sname) { | 228 | if (!ptmp->name || !ptmp->sname) { |
229 | free(ptmp->name); | ||
230 | free(ptmp->sname); | ||
231 | free(ptmp); | ||
229 | X509V3err(X509V3_F_X509_PURPOSE_ADD, ERR_R_MALLOC_FAILURE); | 232 | X509V3err(X509V3_F_X509_PURPOSE_ADD, ERR_R_MALLOC_FAILURE); |
230 | return 0; | 233 | return 0; |
231 | } | 234 | } |
@@ -242,11 +245,17 @@ X509_PURPOSE_add(int id, int trust, int flags, | |||
242 | /* If its a new entry manage the dynamic table */ | 245 | /* If its a new entry manage the dynamic table */ |
243 | if (idx == -1) { | 246 | if (idx == -1) { |
244 | if (!xptable && !(xptable = sk_X509_PURPOSE_new(xp_cmp))) { | 247 | if (!xptable && !(xptable = sk_X509_PURPOSE_new(xp_cmp))) { |
248 | free(ptmp->name); | ||
249 | free(ptmp->sname); | ||
250 | free(ptmp); | ||
245 | X509V3err(X509V3_F_X509_PURPOSE_ADD, | 251 | X509V3err(X509V3_F_X509_PURPOSE_ADD, |
246 | ERR_R_MALLOC_FAILURE); | 252 | ERR_R_MALLOC_FAILURE); |
247 | return 0; | 253 | return 0; |
248 | } | 254 | } |
249 | if (!sk_X509_PURPOSE_push(xptable, ptmp)) { | 255 | if (!sk_X509_PURPOSE_push(xptable, ptmp)) { |
256 | free(ptmp->name); | ||
257 | free(ptmp->sname); | ||
258 | free(ptmp); | ||
250 | X509V3err(X509V3_F_X509_PURPOSE_ADD, | 259 | X509V3err(X509V3_F_X509_PURPOSE_ADD, |
251 | ERR_R_MALLOC_FAILURE); | 260 | ERR_R_MALLOC_FAILURE); |
252 | return 0; | 261 | return 0; |