Skip to content

Commit

Permalink
UDF: Close small mem leak in udf_find_entry()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jesper Juhl authored and Jan Kara committed Jan 6, 2011
1 parent 4651c59 commit a4264b3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/udf/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4264b3

Please sign in to comment.