summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 23:21:10 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 23:22:50 +0200
commit935131744634f9a29e5d53a06a411dbb455cb1ae (patch)
treebc5d5ecc90c8c86389f5c17d703783b6cb6552f5
parenta145b172b45b0afa131f44e00dfd90e88088069b (diff)
Fix potential resource leak in deserialize_tree
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/sqfs/deserialize_fstree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqfs/deserialize_fstree.c b/lib/sqfs/deserialize_fstree.c
index 8ed6314..46e58e0 100644
--- a/lib/sqfs/deserialize_fstree.c
+++ b/lib/sqfs/deserialize_fstree.c
@@ -62,8 +62,10 @@ static int fill_dir(meta_reader_t *ir, meta_reader_t *dr, tree_node_t *root,
return -1;
diff = sizeof(*ent) + strlen((char *)ent->name);
- if (diff > size)
+ if (diff > size) {
+ free(ent);
break;
+ }
size -= diff;
if (should_skip(ent->type, flags)) {