Index: uspace/lib/c/generic/dnsr.c
===================================================================
--- uspace/lib/c/generic/dnsr.c	(revision 741b2fb1909363f2ca0ec5f58957ea347df82946)
+++ uspace/lib/c/generic/dnsr.c	(revision 401840b5d61883eddc5a5ed7e17b2802d2210175)
@@ -69,8 +69,4 @@
 int dnsr_name2host(const char *name, dnsr_hostinfo_t **rinfo, ip_ver_t ver)
 {
-	dnsr_hostinfo_t *info = calloc(1, sizeof(dnsr_hostinfo_t));
-	if (info == NULL)
-		return ENOMEM;
-	
 	async_exch_t *exch = dnsr_exchange_begin();
 	
@@ -85,4 +81,8 @@
 		return rc;
 	}
+
+	dnsr_hostinfo_t *info = calloc(1, sizeof(dnsr_hostinfo_t));
+	if (info == NULL)
+		return ENOMEM;
 	
 	ipc_call_t answer_addr;
@@ -96,4 +96,5 @@
 		async_exchange_end(exch);
 		async_forget(req);
+		free(info);
 		return (int) retval_addr;
 	}
@@ -111,4 +112,5 @@
 	if (retval_cname != EOK) {
 		async_forget(req);
+		free(info);
 		return (int) retval_cname;
 	}
@@ -117,14 +119,17 @@
 	async_wait_for(req, &retval);
 	
-	if (retval != EOK)
+	if (retval != EOK) {
+		async_forget(req);
+		free(info);
 		return (int) retval;
-	
+	}
+
 	size_t act_size = IPC_GET_ARG2(answer_cname);
 	assert(act_size <= DNSR_NAME_MAX_SIZE);
 	
 	cname_buf[act_size] = '\0';
-	
+
 	info->cname = str_dup(cname_buf);
-	
+
 	*rinfo = info;
 	return EOK;
