mirror of https://github.com/getdnsapi/getdns.git
Fixed a couple of null pointer problems
There were two null pointers causing it to dump core. I realize the code doesn't actually do anything, but still.
This commit is contained in:
parent
b3ed4429d6
commit
096d4e5b77
|
@ -43,7 +43,7 @@ int main()
|
|||
/* Be sure the search returned something */
|
||||
uint32_t * this_error = NULL;
|
||||
this_ret = getdns_dict_get_int(this_response, "status", this_error); // Ignore any error
|
||||
if (*this_error != GETDNS_RESPSTATUS_GOOD) // If the search didn't return "good"
|
||||
if (this_error && (*this_error != GETDNS_RESPSTATUS_GOOD)) // If the search didn't return "good"
|
||||
{
|
||||
fprintf(stderr, "The search had no results, and a return value of %d. Exiting.", *this_error);
|
||||
return(GETDNS_RETURN_GENERIC_ERROR);
|
||||
|
@ -53,6 +53,7 @@ int main()
|
|||
size_t * num_addresses_ptr = NULL;
|
||||
this_ret = getdns_list_get_length(just_the_addresses_ptr, num_addresses_ptr); // Ignore any error
|
||||
/* Go through each record */
|
||||
if (num_addresses_ptr) {
|
||||
for ( size_t rec_count = 0; rec_count <= *num_addresses_ptr; ++rec_count )
|
||||
{
|
||||
struct getdns_dict * this_address;
|
||||
|
@ -63,6 +64,7 @@ int main()
|
|||
printf("The address is %s", getdns_display_ip_address(this_address_data));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Clean up */
|
||||
getdns_context_destroy(this_context);
|
||||
getdns_free_sync_request_memory(this_response);
|
||||
|
|
Loading…
Reference in New Issue