WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Fix leak in blkback initialization

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Fix leak in blkback initialization
From: glommer@xxxxxxxxxx (Glauber de Oliveira Costa)
Date: Wed, 4 Jan 2006 15:15:06 +0000
Delivery-date: Wed, 04 Jan 2006 17:21:05 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
In case of failing due to lack of memory in the system, blkif_init
potentially leaves a leak if some of the allocations was sucessfully
suceeded.

This patch frees the memory allocated, avoiding the leak.

Signed-off-by: Glauber de Oliveira Costa <glommer@xxxxxxxxxx>
-- 
glommer
# HG changeset patch
# User root@kct
# Node ID 0b7920d3ca98c3c011b2756afcffb7e2c31b7d2d
# Parent  8f6d4878d02e65438dabda642d7bf84679dbd464

In case of failing due to lack of memory in the system, blkif_init
potentially leaves a leak if some of the allocations was sucessfully
suceeded. 

This patch frees the memory allocated, avoiding the leak. 

Signed-off-by: Glauber de Oliveira Costa <glommer@xxxxxxxxxx>

diff -r 8f6d4878d02e -r 0b7920d3ca98 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Tue Jan  3 
19:01:55 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Wed Jan  4 
13:55:33 2006
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>