From b0f4e5099ec33aed4ebae28c34945fc30a98b04b Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 23 Feb 2006 00:29:04 +0000 Subject: [PATCH] ntfs_create: add for any case check --- libntfs/dir.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libntfs/dir.c b/libntfs/dir.c index a2c22991..d62c327e 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1314,6 +1314,17 @@ err_out: "inode 0x%llx. Run chkdsk.\n", (unsigned long long)ni->mft_no); } + /* + * Free extent MFT records (should not exist any with current + * ntfs_create implementation, but for any case if something will be + * changed in the future). + */ + while (ni->nr_extents) + if (ntfs_mft_record_free(ni->vol, *(ni->extent_nis))) { + err = errno; + ntfs_log_error("Failed to free extent MFT record. " + "Leaving inconsistent metadata.\n"); + } if (ntfs_mft_record_free(ni->vol, ni)) ntfs_log_error("Failed to free MFT record. " "Leaving inconsistent metadata. Run chkdsk.\n");