From: Jesper Juhl Date: Sun, 12 Dec 2010 22:18:15 +0000 (+0100) Subject: UDF: Close small mem leak in udf_find_entry() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a4264b3f4049ae7aeeb0017f8158119e22fa354f;p=linux-beck.git UDF: Close small mem leak in udf_find_entry() Hi, There's a small memory leak in fs/udf/namei.c::udf_find_entry(). We dynamically allocate memory for 'fname' with kmalloc() and in most situations we free it before we leave the function, but there is one situation where we do not (but should). This patch closes the leak by jumping to the 'out_ok' label which does the correct cleanup rather than doing half the cleanup and returning directly. Signed-off-by: Jesper Juhl Signed-off-by: Jan Kara --- diff --git a/fs/udf/namei.c b/fs/udf/namei.c index a2974f7563a2..2be0f9eb86d2 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -227,10 +227,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, } if ((cfi->fileCharacteristics & FID_FILE_CHAR_PARENT) && - isdotdot) { - brelse(epos.bh); - return fi; - } + isdotdot) + goto out_ok; if (!lfi) continue;