]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ubifs: Fix bad free() sequence in ubifs_finddir()
authorWolfgang Denk <wd@denx.de>
Thu, 28 Jul 2011 13:27:22 +0000 (15:27 +0200)
committerStefan Roese <sr@denx.de>
Fri, 19 Aug 2011 15:21:02 +0000 (17:21 +0200)
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>
fs/ubifs/ubifs.c

index 5a5c739b53f5caccf1936efa7bbe93178f11494e..61f70b29604c0a7fcf8e4ff1236286b19959cf7f 100644 (file)
@@ -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;
 }