summaryrefslogtreecommitdiffstats
path: root/libsparse/output_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsparse/output_file.c')
-rw-r--r--libsparse/output_file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libsparse/output_file.c b/libsparse/output_file.c
index 2428022..a28b0a5 100644
--- a/libsparse/output_file.c
+++ b/libsparse/output_file.c
@@ -722,10 +722,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;