diff options
| author | miod <> | 2015-07-15 17:02:03 +0000 |
|---|---|---|
| committer | miod <> | 2015-07-15 17:02:03 +0000 |
| commit | 21bea988abbd8c616153db260cc1905b64c42a61 (patch) | |
| tree | 32c35c9319ee680412776688f1cf64d2a14b352e /src/lib/libc | |
| parent | ae259ed331894d2935596623bd770f70efe90e71 (diff) | |
| download | openbsd-21bea988abbd8c616153db260cc1905b64c42a61.tar.gz openbsd-21bea988abbd8c616153db260cc1905b64c42a61.tar.bz2 openbsd-21bea988abbd8c616153db260cc1905b64c42a61.zip | |
Memory leak; Coverity CID 78836
ok beck@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/x509v3/pcy_tree.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/libcrypto/x509v3/pcy_tree.c b/src/lib/libcrypto/x509v3/pcy_tree.c index fa0e161562..9e54f233ad 100644 --- a/src/lib/libcrypto/x509v3/pcy_tree.c +++ b/src/lib/libcrypto/x509v3/pcy_tree.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pcy_tree.c,v 1.13 2015/02/07 13:19:15 doug Exp $ */ | 1 | /* $OpenBSD: pcy_tree.c,v 1.14 2015/07/15 17:02:03 miod 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 2004. | 3 | * project 2004. |
| 4 | */ | 4 | */ |
| @@ -669,7 +669,7 @@ X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, | |||
| 669 | STACK_OF(X509) *certs, STACK_OF(ASN1_OBJECT) *policy_oids, | 669 | STACK_OF(X509) *certs, STACK_OF(ASN1_OBJECT) *policy_oids, |
| 670 | unsigned int flags) | 670 | unsigned int flags) |
| 671 | { | 671 | { |
| 672 | int ret; | 672 | int ret, ret2; |
| 673 | X509_POLICY_TREE *tree = NULL; | 673 | X509_POLICY_TREE *tree = NULL; |
| 674 | STACK_OF(X509_POLICY_NODE) *nodes, *auth_nodes = NULL; | 674 | STACK_OF(X509_POLICY_NODE) *nodes, *auth_nodes = NULL; |
| 675 | 675 | ||
| @@ -739,16 +739,18 @@ X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, | |||
| 739 | /* Tree is not empty: continue */ | 739 | /* Tree is not empty: continue */ |
| 740 | 740 | ||
| 741 | ret = tree_calculate_authority_set(tree, &auth_nodes); | 741 | ret = tree_calculate_authority_set(tree, &auth_nodes); |
| 742 | 742 | if (ret == 0) | |
| 743 | if (!ret) | ||
| 744 | goto error; | 743 | goto error; |
| 745 | 744 | ||
| 746 | if (!tree_calculate_user_set(tree, policy_oids, auth_nodes)) | 745 | ret2 = tree_calculate_user_set(tree, policy_oids, auth_nodes); |
| 747 | goto error; | ||
| 748 | 746 | ||
| 747 | /* Return value 2 means auth_nodes needs to be freed */ | ||
| 749 | if (ret == 2) | 748 | if (ret == 2) |
| 750 | sk_X509_POLICY_NODE_free(auth_nodes); | 749 | sk_X509_POLICY_NODE_free(auth_nodes); |
| 751 | 750 | ||
| 751 | if (ret2 == 0) | ||
| 752 | goto error; | ||
| 753 | |||
| 752 | if (tree) | 754 | if (tree) |
| 753 | *ptree = tree; | 755 | *ptree = tree; |
| 754 | 756 | ||
