Index: uspace/srv/net/dnsrsrv/dns_msg.c
===================================================================
--- uspace/srv/net/dnsrsrv/dns_msg.c	(revision 48171fc4f90f30adbbe6e443e48ddd9fb7ffdcf4)
+++ uspace/srv/net/dnsrsrv/dns_msg.c	(revision a0d97f83cd44a9bf7925069dc2adc60e73288376)
@@ -517,5 +517,5 @@
 	int rc;
 
-	msg = calloc(1, sizeof(dns_message_t));
+	msg = dns_message_new();
 	if (msg == NULL)
 		return ENOMEM;
@@ -537,9 +537,4 @@
 	    hdr->opbits);
 
-	list_initialize(&msg->question);
-	list_initialize(&msg->answer);
-	list_initialize(&msg->authority);
-	list_initialize(&msg->additional);
-
 	doff = sizeof(dns_header_t);
 
@@ -599,4 +594,20 @@
 }
 
+dns_message_t *dns_message_new(void)
+{
+	dns_message_t *msg;
+
+	msg = calloc(1, sizeof(dns_message_t));
+	if (msg == NULL)
+		return NULL;
+
+	list_initialize(&msg->question);
+	list_initialize(&msg->answer);
+	list_initialize(&msg->authority);
+	list_initialize(&msg->additional);
+
+	return msg;
+}
+
 void dns_message_destroy(dns_message_t *msg)
 {
Index: uspace/srv/net/dnsrsrv/dns_msg.h
===================================================================
--- uspace/srv/net/dnsrsrv/dns_msg.h	(revision 48171fc4f90f30adbbe6e443e48ddd9fb7ffdcf4)
+++ uspace/srv/net/dnsrsrv/dns_msg.h	(revision a0d97f83cd44a9bf7925069dc2adc60e73288376)
@@ -45,4 +45,5 @@
 extern int dns_message_encode(dns_message_t *, void **, size_t *);
 extern int dns_message_decode(void *, size_t, dns_message_t **);
+extern dns_message_t *dns_message_new(void);
 extern void dns_message_destroy(dns_message_t *);
 extern uint32_t dns_uint32_t_decode(uint8_t *, size_t);
Index: uspace/srv/net/dnsrsrv/query.c
===================================================================
--- uspace/srv/net/dnsrsrv/query.c	(revision 48171fc4f90f30adbbe6e443e48ddd9fb7ffdcf4)
+++ uspace/srv/net/dnsrsrv/query.c	(revision a0d97f83cd44a9bf7925069dc2adc60e73288376)
@@ -52,18 +52,21 @@
 	dns_message_t *msg;
 	dns_message_t *amsg;
-	dns_question_t question;
+	dns_question_t *question;
 	dns_host_info_t *info;
 	int rc;
 
-	question.qname = (char *)name;
-	question.qtype = DTYPE_A;
-	question.qclass = DC_IN;
+	question = calloc(1, sizeof(dns_question_t));
+	if (question == NULL)
+		return ENOMEM;
 
-	msg = calloc(1, sizeof(dns_message_t));
+	question->qname = (char *)name;
+	question->qtype = DTYPE_A;
+	question->qclass = DC_IN;
+
+	msg = dns_message_new();
 	if (msg == NULL)
 		return ENOMEM;
 
-	list_initialize(&msg->question);
-	list_append(&question.msg, &msg->question);
+	list_append(&question->msg, &msg->question);
 
 	msg->id = msg_id++;
@@ -100,4 +103,5 @@
 			    info->addr.ipv4);
 
+			dns_message_destroy(msg);
 			dns_message_destroy(amsg);
 			*rinfo = info;
