mirror of https://github.com/getdnsapi/getdns.git
Report memory errors in json-pointers test
This commit is contained in:
parent
3cc44ffcb1
commit
7647005285
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
getdns_return_t r;
|
getdns_return_t r = GETDNS_RETURN_MEMORY_ERROR;
|
||||||
getdns_dict *dict = NULL;
|
getdns_dict *dict = NULL;
|
||||||
unsigned char bladiebla_str[] = "bla die bla";
|
unsigned char bladiebla_str[] = "bla die bla";
|
||||||
getdns_bindata bladiebla = { sizeof(bladiebla_str), bladiebla_str };
|
getdns_bindata bladiebla = { sizeof(bladiebla_str), bladiebla_str };
|
||||||
|
|
||||||
if (!(dict = getdns_dict_create()))
|
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))
|
else if ((r = getdns_dict_set_int(dict, "/bla/bloe/blie", 53280))
|
||||||
|| (r = getdns_dict_set_int(dict, "/bla/hola", 53281))
|
|| (r = getdns_dict_set_int(dict, "/bla/hola", 53281))
|
||||||
|
@ -26,9 +26,10 @@ int main()
|
||||||
else {
|
else {
|
||||||
char *dict_str = getdns_pretty_print_dict(dict);
|
char *dict_str = getdns_pretty_print_dict(dict);
|
||||||
|
|
||||||
if (!dict_str)
|
if (!dict_str) {
|
||||||
fprintf(stderr, "Could not convert dict to string.\n");
|
fprintf(stderr, "Could not convert dict to string");
|
||||||
else {
|
r = GETDNS_RETURN_MEMORY_ERROR;
|
||||||
|
} else {
|
||||||
printf("%s\n", dict_str);
|
printf("%s\n", dict_str);
|
||||||
free(dict_str);
|
free(dict_str);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue