memory leak in dentry_open()
PATCH 1/1 memory leak in dentry_open()
Hi.
There is a memory leak possible in dentry_open(). If get_empty_filp() fails, then the references to dentry and mnt need to be released. The attached patch adds the calls to dput() and mntput() to release these two references.
Thanx...
ps
Signed-off-by Peter Staubach <[email protected]>
fs/open.c renamed from fs/open.c.org +4 -1
@@ -894,8 +894,11 @@ struct file *dentry_open(struct dentry * error = -ENFILE ; f =get_empty_filp (); -if (f ==NULL ) +if (f ==NULL ) { +dput (dentry); +mntput (mnt);return ERR_PTR (error); + }return __dentry_open (dentry, mnt, flags, f,NULL ); }