<div><br></div><div><div>I received a report of an error when a function is called from lispbuilder-sdl-mixer on the Mac in both SBCL and CCL.</div><div><br></div><div><a href="http://pastebin.com/NmLX1Hgg">http://pastebin.com/NmLX1Hgg</a></div>
<div><br></div><div>I think the problem is that CFFI does not allow memory to be freed if that memory has not also been allocated using CFFI.</div><div><br></div><div>In my code below, a new 'sdl-version' struct is returned by (sdl-mixer-cffi::linked-version). The error seems to occur when I try to free the struct at the end of the function using foreign-free.</div>
<div> </div><div>(defun linked-version ()</div><div>    "Returns the version number of the SDL_mixer dynamic library in use as #\(`MAJOR` `MINOR` `PATCH`\)."</div><div>  (let ((sdl-version (sdl-mixer-cffi::linked-version))</div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span>(version nil))</div><div>    (cffi:with-foreign-slots ((sdl-cffi::major sdl-cffi::minor sdl-cffi::patch) sdl-version sdl-cffi::sdl-version)</div><div>      (setf version (vector sdl-cffi::major sdl-cffi::minor sdl-cffi::patch)))</div>
<div>    (cffi:foreign-free sdl-version)</div><div>    version))</div><div><br></div><div>Can I get around this somehow?</div><div><br></div><div>-Luke</div></div>