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

[Xen-devel] [PATCH 3/3] tools/libxc/xc_linux_osdep.c: Don't leak mmap() mapping on map_foreign_bulk() error path



From: Pramod Devendra <pramod.devendra@xxxxxxxxxx>

Signed-off-by: Pramod Devendra <pramod.devendra@xxxxxxxxxx>
CC: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_linux_osdep.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
index b6c435a..ce59590 100644
--- a/tools/libxc/xc_linux_osdep.c
+++ b/tools/libxc/xc_linux_osdep.c
@@ -323,6 +323,7 @@ static void *linux_privcmd_map_foreign_bulk(xc_interface 
*xch, xc_osdep_handle h
             if ( pfn == MAP_FAILED )
             {
                 PERROR("xc_map_foreign_bulk: mmap of pfn array failed");
+                (void)munmap(addr, (unsigned long)num << XC_PAGE_SHIFT);
                 return NULL;
             }
         }
-- 
1.7.10.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®.