[racket] ffi/unsafe and free

From: Neil Caldwell (ncaldwell at alumnaie.net)
Date: Wed Jan 25 19:10:16 EST 2012

Hi

I've just started playing with racket, and decided to start with a
small (that's what I'm telling myself, anyway) project in the form of
an xmms2 client. To do this, I'm having to interface with
libxmmsclient. Long story short, I'm having a problem with free, and
was hoping to get some advice.

If I put the following code into ptr.rkt:
####################################

#lang racket

(require ffi/unsafe)

(free (malloc _pointer))

####################################

and then run it I get a double free error.

####################################

$ racket ptr.rkt
*** glibc detected *** /home/neil/apps/racket-5.2/bin/racket: double
free or corruption (out): 0xb45d4488 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6b6d1)[0xb76ed6d1]

####################################

I haven't had much luck googling, unfortunatly (I could be search the
wrong things)

Is this a problem with racket (v 5.2), my setup (compiled it myself
with all the default switches), glibc version incompatibility, or am I
just doing something plain wrong?

Thanks for the help,

Neil

Posted on the users mailing list.