aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/read_inode.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-23 01:33:50 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-23 02:09:51 +0200
commit7c028e224978e1d5a4f207cc42b9eb58d81897dd (patch)
treed7165e3b9d1a7041cd79712526ad472c21135bdc /lib/sqfs/read_inode.c
parent0a5383ccdf8e87d2259d02a9ff44420b3bc3f58d (diff)
Some simple search/replace cases for allocation
This commit exchanges some malloc(x + y * z) patterns that can be found with a simple git grep and are obvious for the new wrappers. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/read_inode.c')
-rw-r--r--lib/sqfs/read_inode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqfs/read_inode.c b/lib/sqfs/read_inode.c
index d13198e..79c5a55 100644
--- a/lib/sqfs/read_inode.c
+++ b/lib/sqfs/read_inode.c
@@ -7,6 +7,7 @@
#include "config.h"
#include "meta_reader.h"
+#include "util.h"
#include <sys/stat.h>
#include <stdlib.h>
@@ -89,7 +90,7 @@ static sqfs_inode_generic_t *read_inode_file(meta_reader_t *ir,
count = get_block_count(file.file_size, block_size,
file.fragment_index, file.fragment_offset);
- out = calloc(1, sizeof(*out) + count * sizeof(uint32_t));
+ out = alloc_flex(sizeof(*out), sizeof(uint32_t), count);
if (out == NULL) {
perror("reading extended file inode");
return NULL;
@@ -132,7 +133,7 @@ static sqfs_inode_generic_t *read_inode_file_ext(meta_reader_t *ir,
count = get_block_count(file.file_size, block_size,
file.fragment_idx, file.fragment_offset);
- out = calloc(1, sizeof(*out) + count * sizeof(uint32_t));
+ out = alloc_flex(sizeof(*out), sizeof(uint32_t), count);
if (out == NULL) {
perror("reading extended file inode");
return NULL;