summaryrefslogtreecommitdiff
path: root/fs/ubifs/ubifs.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-07-28 15:27:22 +0200
committerStefan Roese <sr@denx.de>2011-08-19 17:21:02 +0200
commit3267bc1b2b52a8ffd0dfda663c02c86eaab6f70d (patch)
tree56a6d6265adbaea79ebb5264145212b29bb1b47d /fs/ubifs/ubifs.c
parentfa82f871c8dbc9a15e8dc274b3f99dd5fa0da458 (diff)
downloadu-boot-imx-3267bc1b2b52a8ffd0dfda663c02c86eaab6f70d.zip
u-boot-imx-3267bc1b2b52a8ffd0dfda663c02c86eaab6f70d.tar.gz
u-boot-imx-3267bc1b2b52a8ffd0dfda663c02c86eaab6f70d.tar.bz2
ubifs: Fix bad free() sequence in ubifs_finddir()
Free private_data member element before freeing file structure. This was causing malloc to crash. Also remove unnecessary variable assigments as file structure gets free'd as well. Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk> Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'fs/ubifs/ubifs.c')
-rw-r--r--fs/ubifs/ubifs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 5a5c739..61f70b2 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -360,6 +360,8 @@ out:
return err;
}
+ if (file->private_data)
+ kfree(file->private_data);
if (file)
free(file);
if (dentry)
@@ -367,10 +369,6 @@ out:
if (dir)
free(dir);
- if (file->private_data)
- kfree(file->private_data);
- file->private_data = NULL;
- file->f_pos = 2;
return 0;
}