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

[Xen-changelog] [xen-unstable] xc_domain_save: allocate pfn_err before use



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1263894030 0
# Node ID b684d9e57b8f80b2b782fd63859fb5d58c01ee16
# Parent  d7e8b6a66a3d3329e515a5f5cbf8f5d3ea43c199
xc_domain_save: allocate pfn_err before use

Due to recent changes related to xc_map_foreign_bulk, xc_domain_save
segfaults because it tries to use pfn_err without allocating it first.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 tools/libxc/xc_domain_save.c |    2 ++
 1 files changed, 2 insertions(+)

diff -r d7e8b6a66a3d -r b684d9e57b8f tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Mon Jan 18 14:49:00 2010 +0000
+++ b/tools/libxc/xc_domain_save.c      Tue Jan 19 09:40:30 2010 +0000
@@ -1273,6 +1273,7 @@ int xc_domain_save(int xc_handle, int io
             if ( batch == 0 )
                 goto skip; /* vanishingly unlikely... */
 
+            pfn_err = realloc(pfn_err, sizeof(int) * batch);
             region_base = xc_map_foreign_bulk(
                 xc_handle, dom, PROT_READ, pfn_type, pfn_err, batch);
             if ( region_base == NULL )
@@ -1832,6 +1833,7 @@ int xc_domain_save(int xc_handle, int io
 
     free(pfn_type);
     free(pfn_batch);
+    free(pfn_err);
     free(to_send);
     free(to_fix);
     free(to_skip);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.