Mailing List Archive

fix possible memory leak if one of the kmalloc fail.
# HG changeset patch
# User vhanquez@kneesa.uk.xensource.com
# Node ID 994e8ee5179d70a5a1b17948ef9016c563949c83
# Parent 0d93a85b5fa4ce0e241e83d4fe1718a4973fcd9b
fix possible memory leak if one of the kmalloc fail.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>

diff -r 0d93a85b5fa4 -r 994e8ee5179d linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Sat Dec 31 19:35:11 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Sat Dec 31 20:17:45 2005
@@ -540,6 +540,9 @@
pending_vaddrs = kmalloc(sizeof(pending_vaddrs[0]) *
mmap_pages, GFP_KERNEL);
if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) {
+ kfree(pending_reqs);
+ kfree(pending_grant_handles);
+ kfree(pending_vaddrs);
printk("%s: out of memory\n", __FUNCTION__);
return -1;
}

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