memory leak fixes

This commit is contained in:
Willem Toorop 2015-07-08 11:07:44 +02:00
parent 51a04f8f6c
commit a5bacfefcf
2 changed files with 10 additions and 8 deletions

View File

@ -2928,7 +2928,7 @@ getdns_root_trust_anchor(time_t *utc_date_of_anchor)
if (!_getdns_parse_ta_file(utc_date_of_anchor, gbuf))
goto error_free_gbuf;
_getdns_wire2list( gldns_buffer_export(gbuf)
_getdns_wire2list( gldns_buffer_begin(gbuf)
, gldns_buffer_position(gbuf), ta_rrs);
gldns_buffer_free(gbuf);

View File

@ -180,16 +180,15 @@ static getdns_return_t validate_chain(getdns_dict *response)
if (!(to_validate = getdns_list_create()))
return GETDNS_RETURN_MEMORY_ERROR;
if (!(trust_anchor = getdns_root_trust_anchor(NULL)))
return GETDNS_RETURN_GENERIC_ERROR;
trust_anchor = getdns_root_trust_anchor(NULL);
if ((r = getdns_dict_get_list(
response, "validation_chain", &validation_chain)))
return r;
goto error;
if ((r = getdns_dict_get_list(
response, "replies_tree", &replies_tree)))
return r;
goto error;
fprintf(stdout, "replies_tree %zu, dnssec_status: ", i);
switch ((s = getdns_validate_dnssec(
@ -218,7 +217,7 @@ static getdns_return_t validate_chain(getdns_dict *response)
while (!(r = getdns_list_get_dict(replies_tree, i++, &reply))) {
if ((r = getdns_list_set_dict(to_validate, 0, reply)))
return r;
goto error;
fprintf( stdout
, "reply %zu, dnssec_status: ", i);
@ -244,8 +243,11 @@ static getdns_return_t validate_chain(getdns_dict *response)
fprintf(stdout, "%d\n", (int)s);
}
}
if (r != GETDNS_RETURN_NO_SUCH_LIST_ITEM)
return r;
if (r == GETDNS_RETURN_NO_SUCH_LIST_ITEM)
r = GETDNS_RETURN_GOOD;
error:
getdns_list_destroy(trust_anchor);
getdns_list_destroy(to_validate);
return GETDNS_RETURN_GOOD;
}