summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/x509/x509_constraints.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/x509/x509_constraints.c b/src/lib/libcrypto/x509/x509_constraints.c
index ecb9de0d95..5abea52e59 100644
--- a/src/lib/libcrypto/x509/x509_constraints.c
+++ b/src/lib/libcrypto/x509/x509_constraints.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_constraints.c,v 1.4 2020/09/18 08:28:45 beck Exp $ */ 1/* $OpenBSD: x509_constraints.c,v 1.5 2020/09/20 03:19:52 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -674,7 +674,7 @@ x509_constraints_extract_names(struct x509_constraints_names *names,
674 X509_NAME *subject_name; 674 X509_NAME *subject_name;
675 GENERAL_NAME *name; 675 GENERAL_NAME *name;
676 ssize_t i = 0; 676 ssize_t i = 0;
677 int name_type, add, include_cn = is_leaf, include_email = is_leaf; 677 int name_type, include_cn = is_leaf, include_email = is_leaf;
678 678
679 /* first grab the altnames */ 679 /* first grab the altnames */
680 while ((name = sk_GENERAL_NAME_value(cert->altname, i++)) != NULL) { 680 while ((name = sk_GENERAL_NAME_value(cert->altname, i++)) != NULL) {
@@ -686,7 +686,6 @@ x509_constraints_extract_names(struct x509_constraints_names *names,
686 goto err; 686 goto err;
687 } 687 }
688 688
689 add = 1;
690 name_type = x509_constraints_general_to_bytes(name, &bytes, 689 name_type = x509_constraints_general_to_bytes(name, &bytes,
691 &len); 690 &len);
692 switch(name_type) { 691 switch(name_type) {
@@ -753,10 +752,11 @@ x509_constraints_extract_names(struct x509_constraints_names *names,
753 break; 752 break;
754 default: 753 default:
755 /* Ignore this name */ 754 /* Ignore this name */
756 add = 0; 755 x509_constraints_name_free(vname);
757 break; 756 vname = NULL;
757 continue;
758 } 758 }
759 if (add && !x509_constraints_names_add(names, vname)) { 759 if (!x509_constraints_names_add(names, vname)) {
760 *error = X509_V_ERR_OUT_OF_MEM; 760 *error = X509_V_ERR_OUT_OF_MEM;
761 goto err; 761 goto err;
762 } 762 }