Original the structure was memset to a poison value. That prevented
_dispose to be made idempotent. We should stop doing so.
Memseting the structure to 0 makes all pointers in structure become
NULL, which can be handled by free().
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>
#include "libxl_internal.h"
-#define LIBXL_DTOR_POISON 0xa5
""" % " ".join(sys.argv))
f.write("void %s(%s)\n" % (ty.dispose_fn, ty.make_arg("p")))
f.write("{\n")
f.write(libxl_C_type_dispose(ty, "p"))
- f.write(" memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n")
+ f.write(" memset(p, 0, sizeof(*p));\n")
f.write("}\n")
f.write("\n")