if ( wq->name ) { kfree(wq->name); wq->name = NULL; } 
kfree(wq->name); wq->name = NULL; 
int autofs_wait(struct autofs_sb_info *sbi, struct qstr *name){	struct autofs_wait_queue *wq;	int status;	/* In catatonic mode, we don't wait for nobody */	if ( sbi->catatonic )		return -ENOENT;		/* We shouldn't be able to get here, but just in case */	if ( name->len > NAME_MAX )		return -ENOENT;	for ( wq = sbi->queues ; wq ; wq = wq->next ) {		if ( wq->hash == name->hash &&		     wq->len == name->len &&		     wq->name && !memcmp(wq->name,name->name,name->len) )			break;	}		if ( !wq ) {		/* Create a new wait queue */		wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);		if ( !wq )			return -ENOMEM;		wq->name = kmalloc(name->len,GFP_KERNEL);		if ( !wq->name ) {			kfree(wq);			return -ENOMEM;		}		wq->wait_queue_token = autofs_next_wait_queue++;		init_waitqueue_head(&wq->queue);		wq->hash = name->hash;		wq->len = name->len;		wq->status = -EINTR; /* Status return if interrupted */		memcpy(wq->name, name->name, name->len);		wq->next = sbi->queues;		sbi->queues = wq;		/* autofs_notify_daemon() may block */		wq->wait_ctr = 2;		autofs_notify_daemon(sbi,wq);	} else		wq->wait_ctr++;	/* wq->name is NULL if and only if the lock is already released */	if ( sbi->catatonic ) {		/* We might have slept, so check again for catatonic mode */		wq->status = -ENOENT;		if ( wq->name ) {			kfree(wq->name);			wq->name = NULL;		}	}	if ( wq->name ) {		/* Block all but "shutdown" signals while waiting */		sigset_t sigmask;		siginitsetinv(&sigmask, SHUTDOWN_SIGS);		sigprocmask(SIG_BLOCK, &sigmask, &sigmask);		interruptible_sleep_on(&wq->queue);		sigprocmask(SIG_SETMASK, &sigmask, NULL);	} else {		DPRINTK(("autofs_wait: skipped sleeping\n"));	}	status = wq->status;	if ( ! --wq->wait_ctr )	/* Are we the last process to need status? */		kfree(wq);	return status;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/f99d49adf527fa6f7a9c42257fa76bca6b8df1e3/waitq.c/buggy/fs/autofs/waitq.c