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

[Xen-devel] [PATCH v2-resend 14/30] libxl: ocaml: make Val_defbool GC-proof



Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
---
 tools/ocaml/libs/xl/xenlight_stubs.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c 
b/tools/ocaml/libs/xl/xenlight_stubs.c
index 53b9d4e..7b7d696 100644
--- a/tools/ocaml/libs/xl/xenlight_stubs.c
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c
@@ -332,15 +332,17 @@ static int Uuid_val(libxl_uuid *c_val, value v)
 static value Val_defbool(libxl_defbool c_val)
 {
        CAMLparam0();
-       CAMLlocal1(v);
+       CAMLlocal2(v1, v2);
+       bool b;
 
        if (libxl_defbool_is_default(c_val))
-               v = Val_none;
+               v2 = Val_none;
        else {
-               bool b = libxl_defbool_val(c_val);
-               v = Val_some(b ? Val_bool(true) : Val_bool(false));
+               b = libxl_defbool_val(c_val);
+               v1 = b ? Val_bool(true) : Val_bool(false);
+               v2 = Val_some(v1);
        }
-       CAMLreturn(v);
+       CAMLreturn(v2);
 }
 
 static libxl_defbool Defbool_val(value v)
-- 
1.7.10.4


_______________________________________________
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®.