Merge branch 'develop' of github.com:verisign/getdns into develop

Conflicts:
	src/util-internal.c
This commit is contained in:
Willem Toorop 2013-11-04 10:36:31 -08:00
commit 8206a9e145
6 changed files with 23 additions and 10 deletions

View File

@ -70,6 +70,8 @@ main()
/* Make the call */
getdns_return_t dns_request_return = getdns_general_sync(this_context, this_name, this_request_type,
this_extensions, &this_response_length, &this_response);
/* free the extensions */
getdns_dict_destroy(this_extensions);
if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME)
{
fprintf(stderr, "A bad domain name was used: %s. Exiting.", this_name);

View File

@ -220,8 +220,11 @@ getdns_list_copy(struct getdns_list *srclist, struct getdns_list **dstlist)
&((*dstlist)->items[i].data.dict));
}
}
else
else {
retval = GETDNS_RETURN_GENERIC_ERROR;
getdns_list_destroy(*dstlist);
*dstlist = NULL;
}
if(retval != GETDNS_RETURN_GOOD)
break;
@ -276,6 +279,10 @@ getdns_list_destroy(struct getdns_list *list)
free(list->items[i].data.bindata->data);
free(list->items[i].data.bindata);
}
else if(list->items[i].dtype == t_dict)
{
getdns_dict_destroy(list->items[i].data.dict);
}
}
free(list->items);
}

View File

@ -146,6 +146,7 @@ void
getdns_free_sync_request_memory(
struct getdns_dict *response
)
{ UNUSED_PARAM(response); }
{
getdns_dict_destroy(response);
}
/* getdns_core_sync.c */

View File

@ -49,6 +49,7 @@ void
tstmsg_prog_end()
{
printf("TESTPROG %s END\n", testprog);
free(testprog);
} /* tstmsg_prog_end */
void

View File

@ -208,13 +208,15 @@ tst_getnames(void)
tstmsg_case_msg("getdns_dict_get_names(NULL, &list)");
getdns_dict_get_names(NULL, &list);
getdns_list_destroy(list);
tstmsg_case_msg("getdns_dict_get_names(dict, NULL)");
getdns_dict_get_names(dict, NULL);
tstmsg_case_msg("getdns_dict_get_names(dict, &list), empty dictionary");
getdns_dict_get_names(dict, &list);
getdns_list_destroy(list);
/* legit use case, add items out of order to exercise tree */
/* TODO: add elements of type dict, bindata, list to the dict */
@ -263,6 +265,7 @@ tst_getnames(void)
}
getdns_dict_destroy(dict);
getdns_list_destroy(list);
tstmsg_case_end();
} /* tst_getnames */
@ -452,6 +455,7 @@ tst_copy(void)
getdns_dict_copy(NULL, NULL);
dict1 = getdns_dict_create();
getdns_dict_copy(dict1, &dict2);
getdns_dict_destroy(dict2);
getdns_dict_copy(NULL, &dict1);
tstmsg_case_msg("dict1 populate");

View File

@ -406,8 +406,7 @@ getdns_dict *create_getdns_response(struct getdns_dns_req* completed_request) {
getdns_list* just_addrs = NULL;
getdns_list* replies_tree = getdns_list_create();
getdns_network_req *netreq = completed_request->first_req;
char *canonical_nm;
char* canonical_name = NULL;
int r = 0;
@ -417,10 +416,9 @@ getdns_dict *create_getdns_response(struct getdns_dns_req* completed_request) {
}
r |= getdns_dict_set_int(result, GETDNS_STR_KEY_STATUS, GETDNS_RESPSTATUS_GOOD);
canonical_nm = get_canonical_name(completed_request->name);
r |= getdns_dict_util_set_string(result, GETDNS_STR_KEY_CANONICAL_NM, canonical_nm);
free(canonical_nm);
canonical_name = get_canonical_name(completed_request->name);
r |= getdns_dict_util_set_string(result, GETDNS_STR_KEY_CANONICAL_NM, canonical_name);
free(canonical_name);
r |= getdns_dict_set_int(result, GETDNS_STR_KEY_ANSWER_TYPE, GETDNS_NAMETYPE_DNS);
while (netreq) {