From: Wolfgang Denk Date: Thu, 28 Jul 2011 13:27:22 +0000 (+0200) Subject: ubifs: Fix bad free() sequence in ubifs_finddir() X-Git-Tag: v2011.09-rc1~73^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3267bc1b2b52a8ffd0dfda663c02c86eaab6f70d;p=u-boot 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 Signed-off-by: Wolfgang Denk Cc: Stefan Roese Signed-off-by: Stefan Roese --- diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 5a5c739b53..61f70b2960 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; }