summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-07-23 20:49:52 +0000
committermiod <miod@openbsd.org>2014-07-23 20:49:52 +0000
commitdf2eea7353a9662db07fade22af26855dcbf6846 (patch)
tree854406329f49231923f1b583005cc04d29a64c92 /lib/libssl/src
parentMake sure PEM_def_callback() correctly handles negative buffer sizes; all uses (diff)
downloadwireguard-openbsd-df2eea7353a9662db07fade22af26855dcbf6846.tar.xz
wireguard-openbsd-df2eea7353a9662db07fade22af26855dcbf6846.zip
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/src')
-rw-r--r--lib/libssl/src/crypto/x509v3/pcy_node.c11
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