Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Only allocate the needed memory
Baptiste Daroussin committed 12 years ago
commit 1ae68c0b1b471acc191f08052deda966be8b5bfb
parent dc88d4a
1 file changed +1 -1
modified libpkg/dns_utils.c
@@ -68,7 +68,7 @@ compute_weight(struct dns_srvinfo **d, int first, int last)
{
	int i, j;
	int totalweight = 0;
-
	int *chosen = malloc(sizeof(int) * last - first + 1);
+
	int *chosen = malloc(sizeof(int) * (last - first + 1));

	for (i = 0; i <= last; i++)
		totalweight += d[i]->weight;