From: Keir Fraser Date: Mon, 20 Dec 2010 09:24:55 +0000 (+0000) Subject: xenbus: Fix memory leak on release X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d86d26e8c0f0ee3bdf0658bed5359841194ed6cc;p=legacy%2Flinux-2.6.18-xen.git xenbus: Fix memory leak on release Pending responses were leaked on close. Signed-off-by: Daniel De Graaf Signed-off-by: Jan Beulich --- diff --git a/drivers/xen/xenbus/xenbus_dev.c b/drivers/xen/xenbus/xenbus_dev.c index f4b364a9..f3721a78 100644 --- a/drivers/xen/xenbus/xenbus_dev.c +++ b/drivers/xen/xenbus/xenbus_dev.c @@ -359,6 +359,7 @@ static int xenbus_dev_release(struct inode *inode, struct file *filp) struct xenbus_dev_data *u = filp->private_data; struct xenbus_dev_transaction *trans, *tmp; struct watch_adapter *watch, *tmp_watch; + struct read_buffer *rb, *tmp_rb; list_for_each_entry_safe(trans, tmp, &u->transactions, list) { xenbus_transaction_end(trans->handle, 1); @@ -372,6 +373,10 @@ static int xenbus_dev_release(struct inode *inode, struct file *filp) free_watch_adapter(watch); } + list_for_each_entry_safe(rb, tmp_rb, &u->read_buffers, list) { + list_del(&rb->list); + kfree(rb); + } kfree(u); return 0;