Fix ffi_closure usage
Fix ffi_closure usage

We were using munmap() instead of g_callable_info_free_closure() to
free the return value of g_callable_info_prepare_closure(). This used
to work, but will silently fail (and leak the memory) now. However,
since invoke_info->closure is sometimes allocated via
g_callable_info_prepare_closure(), and sometimes allocated directly,
this now requires two separate codepaths when freeing it.

Also, update the GDestroyNotify-based codepath (which was copy+pasted
from g_callable_info_prepare_closure() to use ffi_closure_alloc() now
as well.

https://bugzilla.gnome.org/show_bug.cgi?id=615078

magcius/gjs,joeshaw/gjs,magcius/gjs,mtwebster/cjs,mtwebster/cjs,pixunil/cjs,mtwebster/cjs,djdeath/gjs,endlessm/gjs,joeshaw/gjs,mtwebster/cjs,endlessm/gjs,djdeath/gjs,djdeath/gjs,djdeath/gjs,pixunil/cjs,magcius/gjs,endlessm/gjs,pixunil/cjs,endlessm/gjs,joeshaw/gjs,joeshaw/gjs,mtwebster/cjs,magcius/gjs,endlessm/gjs,pixunil/cjs,joeshaw/gjs,magcius/gjs,djdeath/gjs,pixunil/cjs