Plug a possible memory leak.
MFC after: 2 weeks
This commit is contained in:
parent
22301795e1
commit
12b0d76c86
@ -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