Fixed use after free and leak.
@@ -720,7 +720,7 @@ char** crypto_cert_get_dns_names(X509* x509, int* count, int** lengths)
if (list.count == 0)
{
string_list_free(&list);
- return 0;
+ return NULL;
}
/* lengths are not useful, since we converted the
@@ -730,11 +730,12 @@ char** crypto_cert_get_dns_names(X509* x509, int* count, int** lengths)
if (!result || !(*lengths))
{
+ string_list_free(&list);
free(result);
free(*lengths);
(*lengths) = 0;
(*count) = 0;
- return result;
+ return NULL;
}
for (i = 0; i < list.count; i ++)
