summaryrefslogtreecommitdiffstats
path: root/libsparse
diff options
context:
space:
mode:
Diffstat (limited to 'libsparse')
-rw-r--r--libsparse/backed_block.c2
-rw-r--r--libsparse/output_file.c14
2 files changed, 5 insertions, 11 deletions
diff --git a/libsparse/backed_block.c b/libsparse/backed_block.c
index dfb217b..3e72b57 100644
--- a/libsparse/backed_block.c
+++ b/libsparse/backed_block.c
@@ -370,7 +370,7 @@ int backed_block_split(struct backed_block_list *bbl, struct backed_block *bb,
}
new_bb = malloc(sizeof(struct backed_block));
- if (bb == NULL) {
+ if (new_bb == NULL) {
return -ENOMEM;
}
diff --git a/libsparse/output_file.c b/libsparse/output_file.c
index 5014e4a..e63c4a9 100644
--- a/libsparse/output_file.c
+++ b/libsparse/output_file.c
@@ -18,6 +18,7 @@
#define _LARGEFILE64_SOURCE 1
#include <fcntl.h>
+#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
@@ -46,15 +47,6 @@
#define off64_t off_t
#endif
-#ifdef __BIONIC__
-extern void* __mmap2(void *, size_t, int, int, int, off_t);
-static inline void *mmap64(void *addr, size_t length, int prot, int flags,
- int fd, off64_t offset)
-{
- return __mmap2(addr, length, prot, flags, fd, offset >> 12);
-}
-#endif
-
#define min(a, b) \
({ typeof(a) _a = (a); typeof(b) _b = (b); (_a < _b) ? _a : _b; })
@@ -351,7 +343,7 @@ static int write_sparse_skip_chunk(struct output_file *out, int64_t skip_len)
int ret, chunk;
if (skip_len % out->block_size) {
- error("don't care size %llu is not a multiple of the block size %u",
+ error("don't care size %"PRIi64" is not a multiple of the block size %u",
skip_len, out->block_size);
return -1;
}
@@ -731,10 +723,12 @@ int write_fd_chunk(struct output_file *out, unsigned int len,
}
pos = lseek64(fd, offset, SEEK_SET);
if (pos < 0) {
+ free(data);
return -errno;
}
ret = read_all(fd, data, len);
if (ret < 0) {
+ free(data);
return ret;
}
ptr = data;