Patrik
Patrik

Reputation: 855

Segfault on free()

I'm having a simple problem: my program segfaults when freeing some memory allocated using calloc(). The last function in the backtrace is _IO_str_pbackfail. Currently I'm using icc version 12.1.6. According to other questions on stack overflow, this I usually caused by heap corruption. By looking at calloc sources, it seems that the function writes some data in the first 16 bytes of the allocated space. I've tried to add a watchpoint on these bytes but the debugger isn't detecting any malicious write. Any ideas on how to track down this issue?

Upvotes: 0

Views: 841

Answers (1)

melpomene
melpomene

Reputation: 85897

You could try running with MALLOC_CHECK_=2 or valgrind.

Upvotes: 1

Related Questions