code_junkie

How to force abort on “glibc detected *** free(): invalid pointer”

Nov 11th, 2011
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. MallocErrorAbort If set, causes abort(3) to be called if an
  2. error was encountered in malloc(3) or
  3. free(3) , such as a calling free(3) on a
  4. pointer previously freed.
  5.  
  6. -L/usr/lib/debug/lib -ldmallocth
  7.  
  8. void *array[512 / sizeof(void *)]; // 100 is just an arbitrary number of backtraces, increase if you want.
  9. size_t size;
  10.  
  11. size = backtrace (array, 512 / sizeof(void *));
  12. backtrace_symbols_fd (array, size, fileno(mp_logfile));
Add Comment
Please, Sign In to add comment