]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_db: fix leak in flist_find_ftyp()
authorAndrey Albershteyn <aalbersh@redhat.com>
Tue, 23 Apr 2024 12:36:14 +0000 (14:36 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 23 Apr 2024 13:02:58 +0000 (15:02 +0200)
When count is zero fl reference is lost. Fix it by freeing the list.

Fixes: a0d79cb37a36 ("xfs_db: make flist_find_ftyp() to check for field existance on disk")
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
db/flist.c

index c81d229ab99c95cc801c792ac04c87c3576f3762..0a6cc5fcee43a3a4b35c52aeaeb8848e9c7e2e7d 100644 (file)
@@ -424,8 +424,10 @@ flist_find_ftyp(
                if (f->ftyp == type)
                        return fl;
                count = fcount(f, obj, startoff);
-               if (!count)
+               if (!count) {
+                       flist_free(fl);
                        continue;
+               }
                fa = &ftattrtab[f->ftyp];
                if (fa->subfld) {
                        flist_t *nfl;