* [PATCH] UDF: Close small mem leak in udf_find_entry()
@ 2010-12-12 22:18 Jesper Juhl
2011-01-06 16:54 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2010-12-12 22:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Jan Kara, Ben Fennema
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 <jj@chaosbits.net>
---
namei.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
compile tested only
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 6d8dc02..899ef91 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -228,10 +228,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;
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] UDF: Close small mem leak in udf_find_entry()
2010-12-12 22:18 [PATCH] UDF: Close small mem leak in udf_find_entry() Jesper Juhl
@ 2011-01-06 16:54 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2011-01-06 16:54 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel, Jan Kara, Ben Fennema
Hi,
On Sun 12-12-10 23:18:15, Jesper Juhl wrote:
> 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.
Thanks. Merged.
Honza
>
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> namei.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> compile tested only
>
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 6d8dc02..899ef91 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -228,10 +228,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;
>
>
>
> --
> Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please.
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-06 16:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-12 22:18 [PATCH] UDF: Close small mem leak in udf_find_entry() Jesper Juhl
2011-01-06 16:54 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®