Skip to content

Commit

Permalink
Workaround double free problems
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
clausecker committed Mar 9, 2013
1 parent 1e53bc1 commit 2b5f8dc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.c
Expand Up @@ -71,6 +71,7 @@
#include <signal.h>
#include <sys/utsname.h>
#include <string.h>
#include <malloc.h>

/* swp */
#define _KCMS_H_
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 2b5f8dc

Please sign in to comment.