x509: Fix leak if there is an empty CDP

This commit is contained in:
Tobias Brunner 2017-03-29 11:16:34 +02:00
parent 5e37f7e550
commit 388351609d
1 changed files with 7 additions and 1 deletions

View File

@ -818,10 +818,12 @@ static void add_cdps(linked_list_t *list, linked_list_t *uris,
enumerator_t *enumerator;
x509_cdp_t *cdp;
char *uri;
int len;
while (uris->remove_last(uris, (void**)&id) == SUCCESS)
{
if (asprintf(&uri, "%Y", id) > 0)
len = asprintf(&uri, "%Y", id);
if (len > 0)
{
if (issuers->get_count(issuers))
{
@ -845,6 +847,10 @@ static void add_cdps(linked_list_t *list, linked_list_t *uris,
list->insert_last(list, cdp);
}
}
else if (!len)
{
free(uri);
}
id->destroy(id);
}
while (issuers->remove_last(issuers, (void**)&id) == SUCCESS)