GlibC Double Free oder Korruption (fclose)
Ich habe zur Laufzeit einen Fehler in meinem C-Programm. Ich habe ein paar Dinge über "Double Free oder Korruption" gefunden, aber nichts Relevantes.
Hier ist mein Code:
void compute_crc32(const char* filename, unsigned long * destination)
{
FILE* tmp_chunk = fopen(filename, "rb");
printf("\n\t\t\tCalculating CRC...");
fflush(stdout);
Crc32_ComputeFile(tmp_chunk, destination);
printf("\t[0x%08lX]", *destination);
fflush(stdout);
fclose(tmp_chunk);
printf("\t[ OK ]");
fflush(stdout);
}
Es scheint die
fclose(tmp_chunk);
löst diesen glibc Fehler aus:
*** glibc detected *** ./crc32: double free or corruption (out): 0x09ed86f0 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x75ee2)[0xb763cee2]
/lib/i386-linux-gnu/libc.so.6(fclose+0x154)[0xb762c424]
./crc32[0x80498be]
./crc32[0x8049816]
./crc32[0x804919c]
./crc32[0x8049cc2]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xb75e04d3]
./crc32[0x8048961]
In der Konsolenausgabe wird der letzte CRC angezeigt, aber nicht das letzte "[OK]" ...
Ich habe nie diese Art von Fehler und habe stundenlang bei Google gesucht, aber nichts wirklich Interessantes in meinem Fall ... bitte helfen Sie :)
Jetzt habe ich noch einen Fehler:
*** glibc detected *** ./xsplit: free(): invalid next size (normal): 0x095a66f0 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x75ee2)[0xb7647ee2]
/lib/i386-linux-gnu/libc.so.6(fclose+0x154)[0xb7637424]
./xsplit[0x80497f7]
./xsplit[0x804919c]
./xsplit[0x8049cd6]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xb75eb4d3]
./xsplit[0x8048961]
Was zur Hölle ist das ? Ich bin verloren... :(