Skip to content

Commit

Permalink
fix uninitialized and uncleared variables
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Mar 14, 2024
1 parent 8a08ea5 commit 6d2421c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/qqbar/roots_poly_squarefree.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ bsprod(acb_poly_t res, slong a, slong b, slong deg, qqbar_srcptr coeffs, acb_ptr
bsprod(f, a, a + (b - a) / 2, deg, coeffs, conj_roots, prec);
bsprod(g, a + (b - a) / 2, b, deg, coeffs, conj_roots, prec);
acb_poly_mul(res, f, g, prec);

acb_poly_clear(f);
acb_poly_clear(g);
}
}

Expand Down Expand Up @@ -117,6 +120,7 @@ _qqbar_roots_poly_squarefree(qqbar_ptr roots, qqbar_srcptr coeffs, slong len, sl
}

fmpz_init(den_bound);
fmpz_init(den);

fmpz_one(den_bound);
for (i = 0; i <= deg; i++)
Expand Down Expand Up @@ -145,21 +149,24 @@ _qqbar_roots_poly_squarefree(qqbar_ptr roots, qqbar_srcptr coeffs, slong len, sl
qqbar_roots_fmpz_poly(roots, t, 0);

fmpz_poly_clear(t);

fmpz_clear(den);
fmpz_clear(den_bound);
return 1;
}

deg_bound = conjugations * deg;
if (deg_bound > deg_limit)
{
fmpz_clear(den);
fmpz_clear(den_bound);
return 0;
}

conj_roots = flint_malloc(sizeof(acb_ptr) * (deg + 1));

for (i = 0; i <= deg; i++)
conj_roots[i] = _acb_vec_init(qqbar_degree(coeffs + i));

fmpz_init(den);
acb_poly_init(cpoly);
acb_poly_init(ct);
fmpz_poly_init(rpoly);
Expand Down

0 comments on commit 6d2421c

Please sign in to comment.