diff --git a/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h b/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h index cde4310e110cd0ce3945066e3e048be239406f28..de241c034c519d3f2f4050fde93e92dba56ef9c1 100644 --- a/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h +++ b/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h @@ -42,8 +42,10 @@ ext::set < string::LinearString < SymbolType > > ApproximateEnhancedCoversComput for ( size_t i = 2; i < x.getContent ( ).size ( ); ++i ) { nextState = constrNextState ( x, previousState, k ); - if ( nextState->elements.size ( ) < 2 ) + if ( nextState->elements.size ( ) < 2 ) { + delete nextState; break; + } delete previousState; Element lastElement = nextState->elements[nextState->elements.size ( ) - 1];