Project

General

Profile

Bug #496

Утечка памяти при return из цикла for в coverage

Added by Alexey Khoroshilov almost 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
High
Target version:
Start date:
10/18/2010
Due date:
% Done:

100%

Estimated time:
Detected in build:
2.8.310
Platform:
Published in build:
2.8.311

Description

В указанной ситуации в примере

coverage CoveragePattern(String* p)
{
        int i;
        int len = length_String(p);
        for (i = 1; i < len; i++)
        {
                String* substr = substringFrom_String(p, len - i);
                int index = indexOfString_String(p, substr);
                if (index != len - i)
                        return {not_trivial};
        }
        return {trivial};
}


память выделенная под переменную substr не освобождается:
CoverageElement _cov_calc_CoveragePattern( String *p )
{
    CoverageElement __res = _CE_OUT_OF_COVERAGE;
    int __up = 0, __cmd = -3;
    int __substr__0_0__initialized = 0;
    _dummy( &__up ); _dummy( &__cmd );
    {
        int i;

        int len = length_String(r(p));

        for( i = 1
           ; i < len
           ; i++
           )
        /*0_0*/
        {
            String* substr = (__substr__0_0__initialized = 1,substringFrom_String(r(p)
            , len - i));

            int index = indexOfString_String(r(p)
            , r(substr));

            if( index != len - i )
            {
                { __res = (CoveragePattern.not_trivial); goto __destroy_body; }
            }

            if( __substr__0_0__initialized )
            {
                __substr__0_0__initialized = 0;
                destroy( substr );
            }

        }

        { __res = (CoveragePattern.trivial); goto __destroy_body; }

    }
goto __destroy_body;
__destroy_body:;
    destroy( p );
    return __res;
}

Associated revisions

Revision 3826 (diff)
Added by Alexey Demakov almost 10 years ago

fixes #496 Утечка памяти при return из цикла for в coverage

History

#1

Updated by Alexey Demakov almost 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3826.

#2

Updated by Alexey Demakov almost 10 years ago

  • Published in build set to 2.8.311
#3

Updated by Alexey Demakov almost 10 years ago

  • Assignee set to Alexey Demakov
  • Target version set to 2.8
#4

Updated by Alexey Khoroshilov almost 10 years ago

Fixed in ctesk-2.8.311-beta-101020. Похоже у меня нет прав изменить статус.

#5

Updated by Alexey Demakov almost 10 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF