diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c index aea2eba720..c9ce315535 100644 --- a/src/src/lookups/dnsdb.c +++ b/src/src/lookups/dnsdb.c @@ -547,10 +547,6 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0))) } /* Loop for list of domains */ -/* Reclaim unused memory */ - -store_reset(yield->s + yield->ptr + 1); - /* If yield NULL we have not found anything. Otherwise, insert the terminating zero and return the result. */ @@ -560,6 +556,10 @@ dns_init(FALSE, FALSE, FALSE); /* clear the dnssec bit for getaddrbyname */ if (!yield || !yield->ptr) return failrc; +/* Reclaim unused memory */ + +store_reset(yield->s + yield->ptr + 1); + *result = string_from_gstring(yield); return OK; }