Fix unmount spare buffer leak
[yaffs2.git] / yaffs_fs.c
index 101cecf1c62e3729fdade0f99b8ce1dc5708c739..7c2a205c57f52d8836b61ddc0b7a77354fe3e543 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 const char *yaffs_fs_c_version =
-    "$Id: yaffs_fs.c,v 1.42 2006-02-08 07:52:51 charles Exp $";
+    "$Id: yaffs_fs.c,v 1.44 2006-03-21 20:31:08 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 #include <linux/config.h>
@@ -1278,6 +1278,9 @@ static void yaffs_put_super(struct super_block *sb)
        yaffs_Device *dev = yaffs_SuperToDevice(sb);
 
        yaffs_GrossLock(dev);
+       
+       yaffs_FlushEntireDeviceCache(dev);
+       
        if (dev->putSuperFunc) {
                dev->putSuperFunc(sb);
        }
@@ -1286,6 +1289,11 @@ static void yaffs_put_super(struct super_block *sb)
 
        /* we assume this is protected by lock_kernel() in mount/umount */
        list_del(&dev->devList);
+       
+       if(dev->spareBuffer){
+               YFREE(dev->spareBuffer);
+               dev->spareBuffer = NULL;
+       }
 
        kfree(dev);
 }