From 55e0d41d4b9b4dd6f850b28d5805db1b26eeb060 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 23 Oct 2014 15:32:35 +0200 Subject: [PATCH] fix: Don't init suffix with uninitialized domain --- src/context.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/context.c b/src/context.c index 3453ff14..eb2c7e9b 100755 --- a/src/context.c +++ b/src/context.c @@ -396,13 +396,6 @@ set_os_defaults(struct getdns_context *context) filechg_check(context, context->fchg_resolvconf); context->suffix = getdns_list_create_with_context(context); - (void) getdns_list_get_length(context->suffix, &length); - if (length == 0 && *domain != 0) { - bindata.data = (uint8_t *)domain; - bindata.size = strlen(domain) + 1; - (void) getdns_list_set_bindata(context->suffix, 0, &bindata); - } - context->upstreams = upstreams_create(context, upstreams_limit); in = fopen(context->fchg_resolvconf->fn, "r"); @@ -480,6 +473,12 @@ set_os_defaults(struct getdns_context *context) } fclose(in); + (void) getdns_list_get_length(context->suffix, &length); + if (length == 0 && *domain != 0) { + bindata.data = (uint8_t *)domain; + bindata.size = strlen(domain) + 1; + (void) getdns_list_set_bindata(context->suffix, 0, &bindata); + } return GETDNS_RETURN_GOOD; } /* set_os_defaults */