diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index 107e808e06ea..7a5d85f812da 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -664,8 +664,11 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits) return -ENOMEM; err = wnd_rescan(wnd); - if (err) + if (err) { + kfree(wnd->free_bits); + wnd->free_bits = NULL; return err; + } wnd->inited = true; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 5fffddea554f..882a36621fbf 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -1556,6 +1556,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) return 0; put_inode_out: + wnd_close(&sbi->mft.bitmap); iput(inode); out: kfree(boot2);