Generally, pointers returned from ccalls should be freed with the free
function from the same library. From the documentation of Libc.free:
Call free from the C standard library. Only use this on memory obtained from
> malloc, not on pointers retrieved from other C libraries. Ptr objects
> obtained from C libraries should be freed by the free functions defined in
> that library, to avoid assertion failures if multiple libc libraries exist
> on the system.
>
So the correct ccall should be: ccall((:free, :libspqr), Void,
(Ptr{Void},), ptr). This is presuming, of course, that the pointer was
allocated using malloc; this is almost certainly the case.