Changeset c4d7bc in git


Ignore:
Timestamp:
Apr 2, 2016, 7:52:19 AM (8 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '4bd32dfef92ec9f5ed8dceee82d14318ae147107')
Children:
e0bdeb5142ac78b52e1fb069d1bda7ab5dce8565
Parents:
d1cc6662de56001c2e61d5c7c84a130b5011acca
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2016-04-02 07:52:19+02:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2017-12-15 12:17:07+01:00
Message:
fix: patch memory leaks in code from syzextra
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/syz4.cc

    rd1cc666 rc4d7bc  
    2323static ideal m_idLeads_test;
    2424static ideal m_idTails_test;
     25static ideal m_syzLeads_test;
    2526
    2627class CLCM_test: public std::vector<bool>
     
    251252  int l;
    252253  sBucketClearAdd(sum, &s, &l);
     254  sBucketDestroy(&sum);
    253255#else   // BUCKETS == 2
    254256  // nothing to do
     
    406408CReducerFinder_test::~CReducerFinder_test()
    407409{
    408   for( CReducersHash::const_iterator it = m_hash.begin(); it != m_hash.end(); it++ )
    409   {
    410     const TReducers& v = it->second;
     410  for( CReducersHash::iterator it = m_hash.begin(); it != m_hash.end(); it++ )
     411  {
     412    TReducers& v = it->second;
    411413    for(TReducers::const_iterator vit = v.begin(); vit != v.end(); vit++ )
    412414      delete const_cast<CLeadingTerm_test*>(*vit);
    413   }
     415    v.erase(v.begin(), v.end());
     416  }
     417  m_hash.erase(m_hash.begin(), m_hash.end());
    414418}
    415419
     
    417421{
    418422  m_L = const_cast<ideal>(L); // for debug anyway
     423  for( CReducersHash::iterator it = m_hash.begin(); it != m_hash.end(); it++ )
     424  {
     425    TReducers& v = it->second;
     426    for(TReducers::const_iterator vit = v.begin(); vit != v.end(); vit++ )
     427      delete const_cast<CLeadingTerm_test*>(*vit);
     428    v.erase(v.begin(), v.end());
     429  }
     430  m_hash.erase(m_hash.begin(), m_hash.end());
    419431  m_hash.clear();
    420432  if( L != NULL )
     
    422434}
    423435
    424 CReducerFinder_test m_checker(NULL);
    425 CReducerFinder_test m_div(NULL);
     436static CReducerFinder_test m_checker(NULL);
     437static CReducerFinder_test m_div(NULL);
    426438
    427439class CDivisorEnumerator_test
     
    610622  const int c = p_GetComp(s, r) - 1;
    611623  const poly t = TraverseTail_test(b, c);
     624  pDelete(&b);
    612625  if( t != NULL )
    613626    s = p_Add_q(s, t, r);
     
    808821static void setGlobalVariables(const resolvente res, const int index)
    809822{
     823    idDelete(&m_idLeads_test);
     824    idDelete(&m_idTails_test);
     825    idDelete(&m_syzLeads_test);
    810826    m_idLeads_test = idCopy(res[index-1]);
    811827    m_idTails_test = idInit(IDELEMS(res[index-1]), 1);
     
    816832    m_div.redefine(m_idLeads_test);
    817833    m_lcm.redefine(m_idLeads_test);
    818     ideal m_syzLeads_test = idCopy(res[index]);
     834    m_syzLeads_test = idCopy(res[index]);
    819835    for (int i = IDELEMS(res[index])-1; i >= 0; i--) {
    820836        pDelete(&m_syzLeads_test->m[i]->next);
     837        m_syzLeads_test->m[i]->next = NULL;
    821838    }
    822839    m_checker.redefine(m_syzLeads_test);
     
    848865    for (int j = res[index]->ncols-1; j >= 0; j--) {
    849866        p = res[index]->m[j];
     867        pDelete(&res[index]->m[j]->next);
    850868        p->next = NULL;
    851         pDelete(&res[index]->m[j]->next);
    852869        res[index]->m[j]->next = TraverseNF_test(p, NULL);
    853870    }
     
    913930    length = computeResolution(res, length, syzHead);
    914931    sortPolys(res, length);
     932
     933    idDelete(&m_idLeads_test);
     934    idDelete(&m_idTails_test);
     935    idDelete(&m_syzLeads_test);
     936
    915937    result->fullres = res;
    916938    result->length = length+1;
Note: See TracChangeset for help on using the changeset viewer.