mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
All caml_alloc_*() functions can throw exceptions, and longjump out of context. If this happens, we leak the xch/xce handle. Reorder the logic to allocate the the Ocaml object first. Fixes:8b3c06a3e5("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free") Fixes:22d5affdf0("tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak") Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Christian Lindig <christian.lindig@citrix.com>