Actions
Bug #496
closedУтечка памяти при return из цикла for в coverage
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