Project

General

Profile

Actions

Bug #496

closed

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

Added by Alexey Khoroshilov about 14 years ago. Updated almost 14 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;
}

Actions #1

Updated by Alexey Demakov about 14 years ago

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

Applied in changeset r3826.

Actions #2

Updated by Alexey Demakov about 14 years ago

  • Published in build set to 2.8.311
Actions #3

Updated by Alexey Demakov about 14 years ago

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

Updated by Alexey Khoroshilov about 14 years ago

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

Actions #5

Updated by Alexey Demakov about 14 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF