svn commit: r287193 - head/usr.sbin/pkg
Xin LI
delphij at FreeBSD.org
Thu Aug 27 06:28:43 UTC 2015
Author: delphij
Date: Thu Aug 27 06:28:42 2015
New Revision: 287193
URL: https://svnweb.freebsd.org/changeset/base/287193
Log:
Plug a possible memory leak.
MFC after: 2 weeks
Modified:
head/usr.sbin/pkg/dns_utils.c
Modified: head/usr.sbin/pkg/dns_utils.c
==============================================================================
--- head/usr.sbin/pkg/dns_utils.c Thu Aug 27 05:39:32 2015 (r287192)
+++ head/usr.sbin/pkg/dns_utils.c Thu Aug 27 06:28:42 2015 (r287193)
@@ -84,7 +84,6 @@ compute_weight(struct dns_srvinfo **d, i
int i, j, totalweight;
int *chosen;
- chosen = malloc(sizeof(int) * (last - first + 1));
totalweight = 0;
for (i = 0; i <= last; i++)
@@ -93,6 +92,8 @@ compute_weight(struct dns_srvinfo **d, i
if (totalweight == 0)
return;
+ chosen = malloc(sizeof(int) * (last - first + 1));
+
for (i = 0; i <= last; i++) {
for (;;) {
chosen[i] = random() % (d[i]->weight * 100 / totalweight);
More information about the svn-src-all
mailing list