aboutsummaryrefslogtreecommitdiff
path: root/bin/gensquashfs/src
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-09-03 20:06:55 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-09-03 20:06:55 +0200
commit587759c6f26ab0b64f0baf1c03587d4f08042817 (patch)
tree8b8d0653b84e2b32ee81c57d9826e7e6aa51fa63 /bin/gensquashfs/src
parent40f0b3382e4ee286d5fbf8255c9ddfeef35a44e6 (diff)
coverity: fix: use-after-free in error path
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/gensquashfs/src')
-rw-r--r--bin/gensquashfs/src/fstree_from_dir.c2
-rw-r--r--bin/gensquashfs/src/glob.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/bin/gensquashfs/src/fstree_from_dir.c b/bin/gensquashfs/src/fstree_from_dir.c
index defc8bf..40b4061 100644
--- a/bin/gensquashfs/src/fstree_from_dir.c
+++ b/bin/gensquashfs/src/fstree_from_dir.c
@@ -24,8 +24,8 @@ int fstree_from_dir(fstree_t *fs, sqfs_dir_iterator_t *dir)
if (S_ISLNK(ent->mode)) {
ret = dir->read_link(dir, &extra);
if (ret) {
- free(ent);
sqfs_perror("readlink", ent->name, ret);
+ free(ent);
return -1;
}
}
diff --git a/bin/gensquashfs/src/glob.c b/bin/gensquashfs/src/glob.c
index 7d37538..27b7baa 100644
--- a/bin/gensquashfs/src/glob.c
+++ b/bin/gensquashfs/src/glob.c
@@ -91,8 +91,8 @@ static int scan_directory(fstree_t *fs, sqfs_dir_iterator_t *dir,
if (S_ISLNK(ent->mode)) {
ret = dir->read_link(dir, &extra);
if (ret) {
- free(ent);
sqfs_perror("readlink", ent->name, ret);
+ free(ent);
return -1;
}
} else if (S_ISREG(ent->mode)) {