diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-07-23 20:49:53 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-07-23 20:49:53 +0000 |
commit | 6977cec54101d4c7e9afccde68d1b164a5b30ab7 (patch) | |
tree | 5e07e29035364d474711e617ec668f1860c7c0c5 /lib/libssl | |
parent | 6e1f0649f47bf8382a0a51929610356f783c29c4 (diff) |
level_add_node(): if a memory allocation failure causes us to attempt to clean
up and return failure, be sure the cleanup work does NOT free objects which
are still being referenced by other objects.
ok guenther@
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/src/crypto/x509v3/pcy_node.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libssl/src/crypto/x509v3/pcy_node.c b/lib/libssl/src/crypto/x509v3/pcy_node.c index 36424ad1d3e..839113ea2fe 100644 --- a/lib/libssl/src/crypto/x509v3/pcy_node.c +++ b/lib/libssl/src/crypto/x509v3/pcy_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcy_node.c,v 1.4 2014/06/12 15:49:31 deraadt Exp $ */ +/* $OpenBSD: pcy_node.c,v 1.5 2014/07/23 20:49:52 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2004. */ @@ -139,9 +139,9 @@ level_add_node(X509_POLICY_LEVEL *level, const X509_POLICY_DATA *data, if (!tree->extra_data) tree->extra_data = sk_X509_POLICY_DATA_new_null(); if (!tree->extra_data) - goto node_error; + goto node_error_cond; if (!sk_X509_POLICY_DATA_push(tree->extra_data, data)) - goto node_error; + goto node_error_cond; } if (parent) @@ -149,9 +149,12 @@ level_add_node(X509_POLICY_LEVEL *level, const X509_POLICY_DATA *data, return node; +node_error_cond: + if (level) + node = NULL; node_error: policy_node_free(node); - return 0; + return NULL; } void |