diff --git a/src/knot/ctl/knotc_main.c b/src/knot/ctl/knotc_main.c
index db26f6ec604414fb50714ba9b11f02dd337c8c4b..34d18b73ec11363ce1c0c116dfb26f89312f1d13 100644
--- a/src/knot/ctl/knotc_main.c
+++ b/src/knot/ctl/knotc_main.c
@@ -717,7 +717,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
 
 	/* Zone checking */
 	int rc = 0;
-	size_t total_size = 0;
+	double total_size = 0;
 
 	/* Generate databases for all zones */
 	const bool sorted = false;
@@ -773,9 +773,8 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
 		if (loader == NULL) {
 			rc = 1;
 			log_zone_error("Could not load zone %s\n", zone->name);
-			hattrie_apply_rev(est.node_table, estimator_free_trie_node, NULL);
 			hattrie_free(est.node_table);
-			break;
+			continue;
 		}
 
 		/* Do a parser run, but do not actually create the zone. */
@@ -786,7 +785,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
 			hattrie_apply_rev(est.node_table, estimator_free_trie_node, NULL);
 			hattrie_free(est.node_table);
 			zs_loader_free(loader);
-			break;
+			continue;
 		}
 
 		/* Only size of ahtables inside trie's nodes is missing. */
@@ -797,14 +796,14 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
 		hattrie_apply_rev(est.node_table, estimator_free_trie_node, NULL);
 		hattrie_free(est.node_table);
 
-		size_t zone_size = (size_t)(((double)(est.rdata_size +
+		double zone_size = ((double)(est.rdata_size +
 		                   est.node_size +
 		                   est.dname_size +
 		                   est.htable_size +
-		                   malloc_size) * ESTIMATE_MAGIC) / (1024.0 * 1024.0));
+		                   malloc_size) * ESTIMATE_MAGIC) / (1024.0 * 1024.0);
 
 		log_zone_info("Zone %s: %zu RRs, used memory estimation is %zuMB.\n",
-		              zone->name, est.record_count, zone_size);
+		              zone->name, est.record_count, (size_t)zone_size);
 		zs_loader_free(loader);
 		total_size += zone_size;
 		conf_free_zone(zone);
@@ -812,7 +811,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
 	hattrie_iter_free(z_iter);
 
 	if (rc == 0 && argc == 0) { // for all zones
-		log_zone_info("Estimated memory consumption for all zones is %zuMB.\n", total_size);
+		log_zone_info("Estimated memory consumption for all zones is %zuMB.\n", (size_t)total_size);
 	}
 
 	return rc;