autofs: fix memory leak of waitqueues in autofs_catatonic_mode
[linux-2.6-block.git] / fs / autofs / waitq.c
index 54c1f8b8b07576b4d59f0b53ec4f017a5c9fd50f..efdc76732faed639104e13a6813a4db220adec55 100644 (file)
@@ -32,8 +32,9 @@ void autofs_catatonic_mode(struct autofs_sb_info *sbi)
                wq->status = -ENOENT; /* Magic is gone - report failure */
                kfree(wq->name.name - wq->offset);
                wq->name.name = NULL;
-               wq->wait_ctr--;
                wake_up_interruptible(&wq->queue);
+               if (!--wq->wait_ctr)
+                       kfree(wq);
                wq = nwq;
        }
        fput(sbi->pipe);        /* Close the pipe */