X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=ocaml%2Fguestfs_c.c;h=fd5e14ae0a30fe4228a8f453d75a90b648b03066;hb=ae45cee728039d7724fc73e5ffb2550c8054d268;hp=3f862ea2b322d37717d4e6151eb33aedd5b7d336;hpb=e72592563c0be15f1b2400e15205d5e803875685;p=libguestfs.git diff --git a/ocaml/guestfs_c.c b/ocaml/guestfs_c.c index 3f862ea..fd5e14a 100644 --- a/ocaml/guestfs_c.c +++ b/ocaml/guestfs_c.c @@ -82,6 +82,7 @@ guestfs_finalize (value gv) caml_remove_global_root (roots[i]); free (roots[i]); } + free (roots); caml_remove_global_root (v); free (v); @@ -327,13 +328,13 @@ event_bitmask_to_event (uint64_t event) } static void -event_callback_wrapper (guestfs_h *g, - void *data, - uint64_t event, - int event_handle, - int flags, - const char *buf, size_t buf_len, - const uint64_t *array, size_t array_len) +event_callback_wrapper_locked (guestfs_h *g, + void *data, + uint64_t event, + int event_handle, + int flags, + const char *buf, size_t buf_len, + const uint64_t *array, size_t array_len) { CAMLparam0 (); CAMLlocal5 (gv, evv, ehv, bufv, arrayv); @@ -360,9 +361,7 @@ event_callback_wrapper (guestfs_h *g, value args[5] = { gv, evv, ehv, bufv, arrayv }; - caml_leave_blocking_section (); rv = caml_callbackN_exn (*(value*)data, 5, args); - caml_enter_blocking_section (); /* Callbacks shouldn't throw exceptions. There's not much we can do * except to print it. @@ -375,6 +374,26 @@ event_callback_wrapper (guestfs_h *g, CAMLreturn0; } +static void +event_callback_wrapper (guestfs_h *g, + void *data, + uint64_t event, + int event_handle, + int flags, + const char *buf, size_t buf_len, + const uint64_t *array, size_t array_len) +{ + /* Ensure we are holding the GC lock before any GC operations are + * possible. (RHBZ#725824) + */ + caml_leave_blocking_section (); + + event_callback_wrapper_locked (g, data, event, event_handle, flags, + buf, buf_len, array, array_len); + + caml_enter_blocking_section (); +} + value ocaml_guestfs_last_errno (value gv) {