mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Plug a possible memory leak.
MFC after: 2 weeks
This commit is contained in:
parent
de84ba19e3
commit
f595a30ba0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287193
@ -84,7 +84,6 @@ compute_weight(struct dns_srvinfo **d, int first, int last)
|
||||
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, int first, int last)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user