hx509: Fix warnings and leaks

This commit is contained in:
Nicolas Williams
2021-03-29 20:47:03 -05:00
parent d88298649b
commit e23bc7d53d
10 changed files with 96 additions and 61 deletions

View File

@@ -561,11 +561,14 @@ hx509_certs_find(hx509_context context,
break;
if (_hx509_query_match_cert(context, q, c)) {
*r = c;
c = NULL;
break;
}
hx509_cert_free(c);
c = NULL;
}
hx509_cert_free(c);
hx509_certs_end_seq(context, certs, cursor);
if (ret)
return ret;
@@ -573,7 +576,7 @@ hx509_certs_find(hx509_context context,
* Return HX509_CERT_NOT_FOUND if no certificate in certs matched
* the query.
*/
if (c == NULL) {
if (*r == NULL) {
hx509_clear_error_string(context);
return HX509_CERT_NOT_FOUND;
}