aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 03:33:46 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 03:33:46 +0200
commit466adf661f1452e8cb8226faf7369e231aee9af3 (patch)
tree6e71110bc5296ae89a5c986821df6b80042b3c8b
parent6f4267eb44ddddd928ee34d455a092a4863a1ea9 (diff)
Fix memory leak in data writer error code paths
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/sqfs/data_writer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqfs/data_writer.c b/lib/sqfs/data_writer.c
index c584f1e..d88c50e 100644
--- a/lib/sqfs/data_writer.c
+++ b/lib/sqfs/data_writer.c
@@ -307,8 +307,10 @@ int write_data_from_fd(data_writer_t *data, file_info_t *fi,
if (!(blk_flags & (BLK_FIRST_BLOCK | BLK_LAST_BLOCK))) {
blk_flags |= BLK_LAST_BLOCK;
- if (add_sentinel_block(data, fi, blk_flags))
+ if (add_sentinel_block(data, fi, blk_flags)) {
+ free(blk);
return -1;
+ }
}
if (handle_fragment(data, blk))
@@ -440,8 +442,10 @@ int write_data_from_fd_condensed(data_writer_t *data, file_info_t *fi,
if (!(blk_flags & (BLK_FIRST_BLOCK | BLK_LAST_BLOCK))) {
blk_flags |= BLK_LAST_BLOCK;
- if (add_sentinel_block(data, fi, blk_flags))
+ if (add_sentinel_block(data, fi, blk_flags)) {
+ free(blk);
return -1;
+ }
}
if (handle_fragment(data, blk))