From 80f2bd4a29118326224d4075f9c267aee5a04722 Mon Sep 17 00:00:00 2001
From: Owen <owenca@users.noreply.github.com>
Date: Thu, 30 Nov 2017 17:41:54 +0000
Subject: [PATCH] Fixes PVS #2477 and #2479: a potential null pointer
dereference
The 'ctx' pointer was utilized before it was verified against nullptr.
---
src/add-ons/kernel/file_systems/ntfs/libntfs/mft.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/add-ons/kernel/file_systems/ntfs/libntfs/mft.c b/src/add-ons/kernel/file_systems/ntfs/libntfs/mft.c
index 0640efe..09eb00f 100644
a
|
b
|
undo_alloc:
|
825 | 825 | if (ntfs_attr_record_resize(m, a, old_alen)) |
826 | 826 | ntfs_log_error("Failed to restore attribute " |
827 | 827 | "record.%s\n", es); |
828 | | ntfs_inode_mark_dirty(ctx->ntfs_ino); |
| 828 | if (ctx) |
| 829 | ntfs_inode_mark_dirty(ctx->ntfs_ino); |
829 | 830 | } |
830 | 831 | if (update_mp) { |
831 | 832 | if (ntfs_attr_update_mapping_pairs(vol->mftbmp_na, 0)) |
… |
… |
undo_alloc:
|
1176 | 1177 | if (ntfs_attr_record_resize(m, a, old_alen)) |
1177 | 1178 | ntfs_log_error("Failed to restore attribute " |
1178 | 1179 | "record.%s\n", es); |
1179 | | ntfs_inode_mark_dirty(ctx->ntfs_ino); |
| 1180 | if (ctx) |
| 1181 | ntfs_inode_mark_dirty(ctx->ntfs_ino); |
1180 | 1182 | } |
1181 | 1183 | if (update_mp) { |
1182 | 1184 | if (ntfs_attr_update_mapping_pairs(vol->mft_na, 0)) |