aboutsummaryrefslogtreecommitdiff
path: root/lib/ext2fs/fileio.c
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 00:58:13 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 00:58:13 +0000
commit815c62dd8fbeaa3900c35f78ebcc58212c51c0fd (patch)
tree1605641dff9d3858f2b1595d8885bb0fe9496f34 /lib/ext2fs/fileio.c
parentb87ec6ea4f276286383543522a5f7e3b73c7d85c (diff)
parent63687023fc2e8871a718cb4e18458eece2e3460c (diff)
downloade2fsprogs-815c62dd8fbeaa3900c35f78ebcc58212c51c0fd.tar.gz
Change-Id: I813a61d2f320785008db3b605d83c943577cd14f
Diffstat (limited to 'lib/ext2fs/fileio.c')
-rw-r--r--lib/ext2fs/fileio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c
index a0b5d971..818f7f05 100644
--- a/lib/ext2fs/fileio.c
+++ b/lib/ext2fs/fileio.c
@@ -475,8 +475,14 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
if (new_block) {
new_block->physblock = file->physblock;
- ext2fs_hashmap_add(fs->block_sha_map, new_block,
- new_block->sha, sizeof(new_block->sha));
+ int ret = ext2fs_hashmap_add(fs->block_sha_map,
+ new_block, new_block->sha,
+ sizeof(new_block->sha));
+ if (ret) {
+ retval = EXT2_ET_NO_MEMORY;
+ free(new_block);
+ goto fail;
+ }
}
if (bmap_flags & BMAP_SET) {