Workaround double free problems

The source code for handling images has a double free problem. Recent versions
of the GNU libc have a mechanism to automagically abort the program in such a
case. This causes Mosaic to crash if images are displayed.

I work around this issue by turning of automatical program abortion with a call
to mallopt().
master
Robert Clausecker 2013-03-09 18:30:05 +07:00
parent 1e53bc1a5f
commit 2b5f8dcd61
1 changed files with 9 additions and 0 deletions

@ -71,6 +71,7 @@
#include <signal.h>
#include <sys/utsname.h>
#include <string.h>
#include <malloc.h>
/* swp */
#define _KCMS_H_
@ -231,6 +232,14 @@ main (int argc, char **argv, char **envp)
/* Since we're doing lots of TCP, just ignore SIGPIPE altogether. */
signal (SIGPIPE, SIG_IGN);
#ifdef M_CHECK_ACTION
/* some code here has the habit of freeing pointers twice. The glibc
catches this and causes the program to abort. In order to make the
code somehow work, we turn aborting the program off. */
mallopt(M_CHECK_ACTION,5);
#endif
InitChildProcessor();
MoCCIPreInitialize();