Skip to content

Commit d7e8950

Browse files
committed
Free authority info access extracted from cert
1 parent af34cc5 commit d7e8950

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/tls.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,23 +2614,28 @@ static int ocsp_parse_cert_url(X509 *cert, char **host_out, char **port_out,
26142614
char **path_out, int *is_https)
26152615
{
26162616
int i;
2617-
bool found_uri = false;
26182617

26192618
AUTHORITY_INFO_ACCESS *aia;
26202619
ACCESS_DESCRIPTION *ad;
2620+
int ret = -1;
26212621

26222622
aia = X509_get_ext_d2i(cert, NID_info_access, NULL, NULL);
26232623

2624+
if (!aia) return 0;
2625+
26242626
for (i = 0; i < sk_ACCESS_DESCRIPTION_num(aia); i++) {
26252627
ad = sk_ACCESS_DESCRIPTION_value(aia, i);
26262628
if (OBJ_obj2nid(ad->method) != NID_ad_OCSP) continue;
26272629
if (ad->location->type != GEN_URI) continue;
2628-
found_uri = true;
26292630

26302631
if (OCSP_parse_url((char *) ad->location->d.ia5->data, host_out,
2631-
port_out, path_out, is_https)) return 1;
2632+
port_out, path_out, is_https)) {
2633+
ret = 1;
2634+
break;
2635+
}
26322636
}
2633-
return found_uri ? -1 : 0;
2637+
AUTHORITY_INFO_ACCESS_free(aia);
2638+
return ret;
26342639
}
26352640

26362641
/*

0 commit comments

Comments
 (0)