Changeset dbb268 in git


Ignore:
Timestamp:
Nov 3, 2017, 11:57:29 AM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
cfaf16d7ec0e634d40eb72124b2b9216565e3177
Parents:
2de0cebc393fed2c7b5d269cc711aa13cdcc73a4
Message:
fix: memory leaks in ntGcd and ntDiv
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/ext_fields/transext.cc

    r2de0ceb rdbb268  
    11471147    DEN(result) = f;
    11481148  }
     1149  else
     1150  {
     1151    p_Delete(&f, ntRing);
     1152  }
    11491153  COM(result) = COM(fa) + COM(fb) + MULT_COMPLEXITY;
    11501154//  definiteGcdCancellation((number)result, cf,FALSE);
     
    17261730  fraction fb = (fraction)b;
    17271731
    1728   poly pa = p_Copy(NUM(fa), ntRing);
    1729   poly pb = p_Copy(NUM(fb), ntRing);
    17301732
    17311733  poly pGcd;
    17321734  if (nCoeff_is_Q(ntCoeffs))
    17331735  {
     1736    poly pa = NUM(fa);
     1737    poly pb = NUM(fb);
    17341738    if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing))
    17351739    {
    1736       pGcd = pa;
     1740      pGcd = p_Copy(pa,ntRing);
    17371741      p_SetCoeff (pGcd, n_SubringGcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
    17381742    }
     
    17411745      number contentpa, contentpb, tmp;
    17421746
    1743       contentpb= p_GetCoeff(pb, ntRing);
     1747      contentpb= n_Copy(p_GetCoeff(pb, ntRing),ntCoeffs);
    17441748      pIter(pb);
    17451749      while (pb != NULL)
     
    17511755      }
    17521756
    1753       contentpa= p_GetCoeff(pa, ntRing);
     1757      contentpa= n_Copy(p_GetCoeff(pa, ntRing),ntCoeffs);
    17541758      pIter(pa);
    17551759      while (pa != NULL)
     
    17651769      n_Delete(&contentpb, ntCoeffs);
    17661770      contentpa= tmp;
    1767       p_Delete(&pb, ntRing);
    1768       p_Delete(&pa, ntRing);
    17691771
    17701772      /* singclap_gcd destroys its arguments; we hence need copies: */
     
    17751777  }
    17761778  else
    1777     pGcd = singclap_gcd(pa, pb, cf->extRing);
     1779    pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(NUM(fb),ntRing), ntRing);
    17781780  /* Note that, over Q, singclap_gcd will remove the denominators in all
    17791781     rational coefficients of pa and pb, before starting to compute
Note: See TracChangeset for help on using the changeset viewer.