aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/libxl/gentypes.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index 175fae3e3c..52cbf1f25b 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -145,15 +145,19 @@ if __name__ == '__main__':
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
#include "libxl.h"
+#define LIBXL_DTOR_POISON 0xa5
+
""" % " ".join(sys.argv))
for ty in [t for t in types if t.destructor_fn is not None and t.autogenerate_destructor]:
f.write("void %s(%s *p)\n" % (ty.destructor_fn, ty.typename))
f.write("{\n")
f.write(libxl_C_type_destroy(ty, "p", True))
+ f.write("\tmemset(p, LIBXL_DTOR_POISON, sizeof(*p));\n")
f.write("}\n")
f.write("\n")
f.close()