Skip to content

Commit

Permalink
fat: cleanup fat_parse_long() error handling
Browse files Browse the repository at this point in the history
Coverity CID 2332 & 2333 RESOURCE_LEAK

In fat_search_long() if fat_parse_long() returns a -ve value we return
without first freeing unicode.  This patch free's them on this error path.

The above was false positive on current tree, but this change is more
clean, so apply as cleanup.

[hirofumi@mail.parknet.co.jp: fix coding style]
Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Darren Jenkins authored and Linus Torvalds committed Nov 6, 2008
1 parent 53472bc commit 52e9d9f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/fat/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,10 @@ int fat_search_long(struct inode *inode, const unsigned char *name,
if (de->attr == ATTR_EXT) {
int status = fat_parse_long(inode, &cpos, &bh, &de,
&unicode, &nr_slots);
if (status < 0)
return status;
else if (status == PARSE_INVALID)
if (status < 0) {
err = status;
goto end_of_dir;
} else if (status == PARSE_INVALID)
continue;
else if (status == PARSE_NOT_LONGNAME)
goto parse_record;
Expand Down

0 comments on commit 52e9d9f

Please sign in to comment.