mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Plug a possible memory leak.
MFC after: 2 weeks
This commit is contained in:
parent
de84ba19e3
commit
f595a30ba0
1 changed files with 2 additions and 1 deletions
|
|
@ -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 a new issue