]> xenbits.xensource.com Git - people/gdunlap/xen.git/commitdiff
gentypes: make dispose function tolerate NULL
authorWei Liu <wei.liu2@citrix.com>
Wed, 25 Feb 2015 14:56:04 +0000 (14:56 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 2 Mar 2015 17:05:39 +0000 (17:05 +0000)
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/gentypes.py

index afd4eeab03cf8230d649480720d899c466fb98c6..00816c0aef365af4e29144e8cf987eeecd0fdbee 100644 (file)
@@ -642,6 +642,7 @@ if __name__ == '__main__':
     for ty in [t for t in types if t.dispose_fn is not None and t.autogenerate_dispose_fn]:
         f.write("void %s(%s)\n" % (ty.dispose_fn, ty.make_arg("p")))
         f.write("{\n")
+        f.write("    if (!p) return;\n")
         f.write(libxl_C_type_dispose(ty, "p"))
         f.write("    memset(p, 0, sizeof(*p));\n")
         f.write("}\n")