[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1/2] xl: add cpuid parameter
On Fri, 2010-08-27 at 15:51 +0100, Ian Campbell wrote: > This would be the first non-const use of Reference it though so it is > possible that gentypes.py is not 100% correct in its handling of > Reference types. I think there is a bug in this handling and I think this patch fixes it. Subject: libxl: correctly free Reference types in autogenerated destroy functions References types should be recursively destroyed and then the actual reference itself should be destroyed. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r a1612bdf9cb3 tools/libxl/gentypes.py --- a/tools/libxl/gentypes.py Fri Aug 27 15:40:05 2010 +0100 +++ b/tools/libxl/gentypes.py Fri Aug 27 15:57:25 2010 +0100 @@ -64,6 +64,11 @@ def libxl_C_type_destroy(ty, v, referenc deref = v + "->" else: deref = v + "." + + if ty.passby == libxltypes.PASS_BY_REFERENCE and not reference: + makeref = "&" + else: + makeref = "" s = "" if isinstance(ty, libxltypes.KeyedUnion): @@ -76,6 +81,8 @@ def libxl_C_type_destroy(ty, v, referenc s += "}\n" elif isinstance(ty, libxltypes.Reference): s += libxl_C_type_destroy(ty.ref_type, v, True, indent, v) + if ty.destructor_fn is not None: + s += "%s(%s);\n" % (ty.destructor_fn, makeref + v) elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.destructor_fn is None): for f in [f for f in ty.fields if not f.const]: @@ -84,11 +91,6 @@ def libxl_C_type_destroy(ty, v, referenc else: s += libxl_C_type_destroy(f.type, deref + f.name, False, "", deref) else: - if ty.passby == libxltypes.PASS_BY_REFERENCE and not reference: - makeref = "&" - else: - makeref = "" - if ty.destructor_fn is not None: s += "%s(%s);\n" % (ty.destructor_fn, makeref + v) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |