Commit 52e9d9f4 authored by Darren Jenkins's avatar Darren Jenkins Committed by Linus Torvalds

fat: cleanup fat_parse_long() error handling

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: default avatarDarren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 53472bc8
...@@ -373,9 +373,10 @@ int fat_search_long(struct inode *inode, const unsigned char *name, ...@@ -373,9 +373,10 @@ int fat_search_long(struct inode *inode, const unsigned char *name,
if (de->attr == ATTR_EXT) { if (de->attr == ATTR_EXT) {
int status = fat_parse_long(inode, &cpos, &bh, &de, int status = fat_parse_long(inode, &cpos, &bh, &de,
&unicode, &nr_slots); &unicode, &nr_slots);
if (status < 0) if (status < 0) {
return status; err = status;
else if (status == PARSE_INVALID) goto end_of_dir;
} else if (status == PARSE_INVALID)
continue; continue;
else if (status == PARSE_NOT_LONGNAME) else if (status == PARSE_NOT_LONGNAME)
goto parse_record; goto parse_record;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment