Skip to contentSkip to conversation

Fix leak in blkback initialization

PATCH In review Glauber de Oliveira Costa 3 participants 3 messages Jan 4, 2006 – Jan 5, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix leak in blkback initialization

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.

Signature · 1 line
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.

linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c +3 -0
diff -r 8f6d4878d02e -r 0b7920d3ca98 linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 5 lines · Glauber de Oliveira Costa

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.

This has already been corrected (changeset 8469)

Thanks,

Signature · 1 line
Vincent Hanquez
#2 lore raw

Yes, I saw that. It just happened to me to see the error a little bit before seeing the correction =]

Thanks,

glommer.

Quoted 9 lines · Vincent Hanquez
Quoted 5 lines · Glauber de Oliveira Costa

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.

This has already been corrected (changeset 8469)

Quoted 9 lines

Thanks,
--
Vincent Hanquez

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Free Software : Technology for a better world
=============================
Glauber de Oliveira Costa
jabber: [email protected]
=============================