summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Zongker <dougz@google.com>2014-08-12 16:55:56 -0700
committerDoug Zongker <dougz@google.com>2014-08-12 16:55:56 -0700
commit9922135de65b717267d8173f61e360fbb9cf1ebd (patch)
treeeaa199f8a6927640c2e127b1fd947a2e8c2d2a96
parentbec598e982301bf2714d37b14e312c9845c7cc0c (diff)
downloadextras-9922135de65b717267d8173f61e360fbb9cf1ebd.tar.gz
fix build
inode_allocate_file_extents should return NULL if allocation fails. Bug: 16984795 Change-Id: I7d2b9d61ca81f8e1869dbac3d8bde79bb5799fa9
-rw-r--r--ext4_utils/contents.c9
-rw-r--r--ext4_utils/extent.c4
2 files changed, 7 insertions, 6 deletions
diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
index fb3a38dc..3144de93 100644
--- a/ext4_utils/contents.c
+++ b/ext4_utils/contents.c
@@ -194,10 +194,11 @@ u32 make_file(const char *filename, u64 len)
if (len > 0) {
struct block_allocation* alloc = inode_allocate_file_extents(inode, len, filename);
-
- alloc->filename = strdup(filename);
- alloc->next = saved_allocation_head;
- saved_allocation_head = alloc;
+ if (alloc) {
+ alloc->filename = strdup(filename);
+ alloc->next = saved_allocation_head;
+ saved_allocation_head = alloc;
+ }
}
inode->i_mode = S_IFREG;
diff --git a/ext4_utils/extent.c b/ext4_utils/extent.c
index 7142c8bb..1900b104 100644
--- a/ext4_utils/extent.c
+++ b/ext4_utils/extent.c
@@ -210,11 +210,11 @@ struct block_allocation* inode_allocate_file_extents(struct ext4_inode *inode, u
alloc = do_inode_allocate_extents(inode, len);
if (alloc == NULL) {
error("failed to allocate extents for %"PRIu64" bytes", len);
- return;
+ return NULL;
}
extent_create_backing_file(alloc, len, filename);
- return alloc;
+ return alloc;
}
/* Allocates enough blocks to hold len bytes and connects them to an inode */