]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
xenbus: Fix memory leak on release
authorKeir Fraser <keir@xen.org>
Mon, 20 Dec 2010 09:24:55 +0000 (09:24 +0000)
committerKeir Fraser <keir@xen.org>
Mon, 20 Dec 2010 09:24:55 +0000 (09:24 +0000)
Pending responses were leaked on close.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
drivers/xen/xenbus/xenbus_dev.c

index f4b364a9f2feea40a64f698dcb81b85f9f195b4b..f3721a78ba410f03cbf1401abc0f6441a205e3fd 100644 (file)
@@ -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;