Issue
My program suddenly crashes and raises this error in core files.
To be exact:
Program terminated with signal 6, Aborted.
#0 0x00c60410 in __kernel_vsyscall ()
#0 0x00c60410 in __kernel_vsyscall ()
#1 0x00444df0 in raise () from /lib/libc.so.6
#2 0x00446701 in abort () from /lib/libc.so.6
#3 0x0047d3ab in __libc_message () from /lib/libc.so.6
#4 0x004856c5 in _int_free () from /lib/libc.so.6
#5 0x00485b09 in free () from /lib/libc.so.6
Is this related to Linux or I am making a mistake in my code?
How to resolve this?
Solution
The error is in free()
, which is likely a function you call in your program, and a common place to make mistakes. You likely freed an invalid pointer (possibly via double-free?). The stack trace shows all those other functions because those were called below free()
. This is common when calling library functions incorrectly, so you generally just keep an eye out for things that you recognize. As a rule of thumb, you'll want to start looking at the furthest thing down a stack trace that you recognize (i.e. is in your program), though if there are other memory corruptions further up the stack or in your program, looking there won't help too much.
Edit for clarity: "Down the stack" means "toward the top of the list," since as sixlettervariables points out, you want to find the most recent place you were that you recognize. I realize that my initial wording could be confusing.
Answered By - Dan Fego Answer Checked By - Willingham (WPSolving Volunteer)