diff options
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 30e59c2806..d36b710401 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -1495,7 +1495,10 @@ KResultOr<Ext2FS::CachedBitmap*> Ext2FS::get_bitmap_block(BlockIndex bitmap_bloc dbgln("Ext2FS: Failed to load bitmap block {}", bitmap_block_index); return result; } - if (!m_cached_bitmaps.try_append(make<CachedBitmap>(bitmap_block_index, move(block)))) + auto new_bitmap = adopt_own_if_nonnull(new CachedBitmap(bitmap_block_index, move(block))); + if (!new_bitmap) + return ENOMEM; + if (!m_cached_bitmaps.try_append(move(new_bitmap))) return ENOMEM; return m_cached_bitmaps.last(); } |