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

[Xen-changelog] [xen master] gentypes: zero out structure in _dispose function



commit d0b80baa985b516fb08ca206c69c5905e816cceb
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Feb 25 14:56:03 2015 +0000
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Mon Mar 2 17:05:39 2015 +0000

    gentypes: zero out structure in _dispose function
    
    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@xxxxxxxxxx>
    Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/gentypes.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index d9e14fd..afd4eea 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -636,7 +636,6 @@ if __name__ == '__main__':
 
 #include "libxl_internal.h"
 
-#define LIBXL_DTOR_POISON 0xa5
 
 """ % " ".join(sys.argv))
 
@@ -644,7 +643,7 @@ if __name__ == '__main__':
         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")
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.