[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for-4.6 12/13] tools/ocaml: call libxl_dominfo_{init, dispose} in stub



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Cc: David Scott <dave.scott@xxxxxxxxxxxxx>

As far as I can tell, all Val_$foo function does deep-copy, so we can
safely call dispose in said function.
---
 tools/ocaml/libs/xl/xenlight_stubs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c 
b/tools/ocaml/libs/xl/xenlight_stubs.c
index 4133527..7b8d6db 100644
--- a/tools/ocaml/libs/xl/xenlight_stubs.c
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c
@@ -979,14 +979,18 @@ value stub_xl_dominfo_get(value ctx, value domid)
        int ret;
        uint32_t c_domid = Int_val(domid);
 
+       libxl_dominfo_init(&c_dominfo);
+
        caml_enter_blocking_section();
        ret = libxl_domain_info(CTX, &c_dominfo, c_domid);
        caml_leave_blocking_section();
 
-       if (ret != 0)
+       if (ret != 0) {
                failwith_xl(ERROR_FAIL, "domain_info");
+               libxl_dominfo_dispose(&c_dominfo);
+       }
        dominfo = Val_dominfo(&c_dominfo);
-
+       libxl_dominfo_dispose(&c_dominfo);
        CAMLreturn(dominfo);
 }
 
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.