]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/xen/xenfs/xenbus.c
xenbus: Fix memory leak on release
[karo-tx-linux.git] / drivers / xen / xenfs / xenbus.c
index 55791dd1105f37b230e700c90ad62b6cac2c933c..8f6c7d4b3e4d30b8463f3ae693658de0d00267b7 100644 (file)
@@ -543,6 +543,7 @@ static int xenbus_file_release(struct inode *inode, struct file *filp)
        struct xenbus_file_priv *u = filp->private_data;
        struct xenbus_transaction_holder *trans, *tmp;
        struct watch_adapter *watch, *tmp_watch;
+       struct read_buffer *rb, *tmp_rb;
 
        /*
         * No need for locking here because there are no other users,
@@ -561,6 +562,10 @@ static int xenbus_file_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;