direct-io.hg

changeset 8469:994e8ee5179d

fix possible memory leak if one of the kmalloc fail.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Sat Dec 31 20:17:45 2005 +0000 (2005-12-31)
parents 0d93a85b5fa4
children 2a873f8020ae
files linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Dec 31 19:35:11 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Dec 31 20:17:45 2005 +0000
     1.3 @@ -540,6 +540,9 @@ static int __init blkif_init(void)
     1.4  	pending_vaddrs        = kmalloc(sizeof(pending_vaddrs[0]) *
     1.5  					mmap_pages, GFP_KERNEL);
     1.6  	if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) {
     1.7 +		kfree(pending_reqs);
     1.8 +		kfree(pending_grant_handles);
     1.9 +		kfree(pending_vaddrs);
    1.10  		printk("%s: out of memory\n", __FUNCTION__);
    1.11  		return -1;
    1.12  	}