summaryrefslogtreecommitdiff
path: root/lib/sqfs/data_writer.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 03:34:04 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 03:34:04 +0200
commit8b9eeb43c4f7d958972b8bf1fd39d19da570224b (patch)
tree30e62f3ee716a8caa5c4151a417739ee439360ea /lib/sqfs/data_writer.c
parent466adf661f1452e8cb8226faf7369e231aee9af3 (diff)
Fix memory leak in data writer fragment deduplication
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/data_writer.c')
-rw-r--r--lib/sqfs/data_writer.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/sqfs/data_writer.c b/lib/sqfs/data_writer.c
index d88c50e..b52e897 100644
--- a/lib/sqfs/data_writer.c
+++ b/lib/sqfs/data_writer.c
@@ -239,12 +239,11 @@ static int handle_fragment(data_writer_t *data, block_t *blk)
fi->fragment_offset = ref->fragment_offset;
fi->fragment = ref->fragment;
fi->flags |= FILE_FLAG_FRAGMENT_IS_DUPLICATE;
- } else {
- if (store_fragment(data, blk))
- return -1;
+ free(blk);
+ return 0;
}
- return 0;
+ return store_fragment(data, blk);
}
static int add_sentinel_block(data_writer_t *data, file_info_t *fi,