Report memory errors in json-pointers test

This commit is contained in:
Willem Toorop 2015-10-21 16:01:16 +02:00
parent 3cc44ffcb1
commit 7647005285
1 changed files with 6 additions and 5 deletions

View File

@ -4,13 +4,13 @@
int main()
{
getdns_return_t r;
getdns_return_t r = GETDNS_RETURN_MEMORY_ERROR;
getdns_dict *dict = NULL;
unsigned char bladiebla_str[] = "bla die bla";
getdns_bindata bladiebla = { sizeof(bladiebla_str), bladiebla_str };
if (!(dict = getdns_dict_create()))
fprintf(stderr, "Could not create dict\n");
fprintf(stderr, "Could not create dict");
else if ((r = getdns_dict_set_int(dict, "/bla/bloe/blie", 53280))
|| (r = getdns_dict_set_int(dict, "/bla/hola", 53281))
@ -26,9 +26,10 @@ int main()
else {
char *dict_str = getdns_pretty_print_dict(dict);
if (!dict_str)
fprintf(stderr, "Could not convert dict to string.\n");
else {
if (!dict_str) {
fprintf(stderr, "Could not convert dict to string");
r = GETDNS_RETURN_MEMORY_ERROR;
} else {
printf("%s\n", dict_str);
free(dict_str);
}