Answer the question
In order to leave comments, you need to log in
What's wrong with free, delete?
Something like this:
char *sval = (char*)calloc( zn, sizeof( char ) );
for( ... ) {
// здесь что-то заполняется эту строку
}
free( (void*)sval );
*** Error in `./period1': free(): invalid next size (fast): 0x09413040 ***
Аварийный останов
Answer the question
In order to leave comments, you need to log in
An error was found: in the loop, it climbed (by writing 0) in the string 1 byte further than the length zn, while the length descriptor of the next memory area is overwritten, and when freed, it is impossible to restore (combine) free regions.
And that's why, at different optimization levels (-O0, ... -O3), the error messages are completely different ... which can drive you crazy.
// здесь что-то заполняется эту строку
More details here. You could change the pointer inside the loopsval
It's best to do this:
And then you will not make a mistake in the loop (it will be found at the compilation stage).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question