提交 3267bc1b 编写于 作者: W Wolfgang Denk 提交者: Stefan Roese

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: NRod Boyce <uboot@teamboyce.co.uk>
Signed-off-by: NWolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: NStefan Roese <sr@denx.de>
上级 fa82f871
...@@ -360,6 +360,8 @@ out: ...@@ -360,6 +360,8 @@ out:
return err; return err;
} }
if (file->private_data)
kfree(file->private_data);
if (file) if (file)
free(file); free(file);
if (dentry) if (dentry)
...@@ -367,10 +369,6 @@ out: ...@@ -367,10 +369,6 @@ out:
if (dir) if (dir)
free(dir); free(dir);
if (file->private_data)
kfree(file->private_data);
file->private_data = NULL;
file->f_pos = 2;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册