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

[Xen-devel] [PATCH 2/2] libxl: zero the vtpm structures on allocation



This avoids returning unallocated memory in the libxl_device_vtpm
structure since libxl_device_vtpm_init is not called here.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Cc:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc:     Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc:     Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index e442afc..2b64700 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1853,7 +1853,7 @@ libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, 
uint32_t domid, int *n
     fe_path = libxl__sprintf(gc, "%s/device/vtpm", libxl__xs_get_dompath(gc, 
domid));
     dir = libxl__xs_directory(gc, XBT_NULL, fe_path, &ndirs);
     if(dir) {
-       vtpms = malloc(sizeof(*vtpms) * ndirs);
+       vtpms = calloc(sizeof(*vtpms), ndirs);
        libxl_device_vtpm* vtpm;
        libxl_device_vtpm* end = vtpms + ndirs;
        for(vtpm = vtpms; vtpm < end; ++vtpm, ++dir) {
-- 
1.8.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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