From 587759c6f26ab0b64f0baf1c03587d4f08042817 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 3 Sep 2023 20:06:55 +0200 Subject: coverity: fix: use-after-free in error path Signed-off-by: David Oberhollenzer --- bin/gensquashfs/src/fstree_from_dir.c | 2 +- bin/gensquashfs/src/glob.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/gensquashfs') 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)) { -- cgit v1.2.3