New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with clang, work around double free #6

Merged
merged 2 commits into from Mar 9, 2013
Jump to file or symbol
Failed to load files and symbols.
+9 −0
Diff settings

Always

Just for now

Next

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().
  • Loading branch information...
fuzxxl committed Mar 9, 2013
commit 2b5f8dcd61c1ba594a5c80ec470d3bb6378f660d
View
@@ -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();
ProTip! Use n and p to navigate between commits in a pull request.