Re: [PATCH] tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()

2023-02-01 Thread Christian Lindig
> On 1 Feb 2023, at 13:29, Andrew Cooper wrote: > > 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: 8b3c06a3e545 ("tools/ocaml/xenctrl:

[PATCH] tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()

2023-02-01 Thread Andrew Cooper
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: 8b3c06a3e545 ("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free") Fixes: 22d5affdf0ce