Damaged unsorted chunks when calling free ()

*** glibc detected *** ./a.out: free(): corrupted unsorted chunks: 0x00000000007646b0 *** *** glibc detected *** ./a.out: malloc(): memory corruption: 0x00000000007635a0 *** 

I get the above error. But I am sure that after release I do not use memory. Why am I getting the above error?

+5
source share
2 answers

All heaps that store certain types of metadata. When you do malloc or free, the heap often performs some functions of storing books on the heap. If he discovers something completely unexpected in the metadata, he usually crashes.

Normal heap operations are unlikely to cause such problems, so your program is likely to become the cause. Because your program has access to all of the memory in the process, including heap metadata, your program might accidentally overwrite some metadata.

The likely reason is to write outside the allocated buffer. This entry is likely to be resolved and is likely to corrupt the heap metadata. When this is detected by the heap, your program usually terminates.

+9
source

Perhaps you are trying to free a pointer that points incorrectly to dynamically allocated memory.

+4
source

Source: https://habr.com/ru/post/1202242/


All Articles