Fix two DNS query related memory leaks