Skip to content

Commit

Permalink
fix: memory leak in walk
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 committed Aug 13, 2012
1 parent 285a393 commit a8ead8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Singular/walk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,7 @@ static intvec* MwalkNextWeightCC(intvec* curr_weight, intvec* target_weight,
mpz_init(t_null);

mpz_t ggt;
mpz_init(ggt);

int tn0, tn1, tz1, ncmp, gcd_tmp, ntmp;
intvec* diff_weight = MivSub(target_weight, curr_weight);
Expand Down Expand Up @@ -1705,7 +1706,7 @@ static intvec* MwalkNextWeightCC(intvec* curr_weight, intvec* target_weight,
#endif

if(j==0)
mpz_init_set(ggt, sntz);
mpz_set(ggt, sntz);
else
if(mpz_cmp_si(ggt,1) != 0)
mpz_gcd(ggt, ggt, sntz);
Expand Down Expand Up @@ -1752,6 +1753,7 @@ static intvec* MwalkNextWeightCC(intvec* curr_weight, intvec* target_weight,

FINISH:

mpz_clear(ggt);
mpz_clear(t_zaehler);
mpz_clear(t_nenner);
mpz_clear(sntz);
Expand Down

0 comments on commit a8ead8e

Please sign in to comment.