From: Andrey Albershteyn Date: Tue, 23 Apr 2024 12:36:14 +0000 (+0200) Subject: xfs_db: fix leak in flist_find_ftyp() X-Git-Tag: v6.8.0~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21dc682a3842eb7e4c79f7e511d840e708d7e757;p=thirdparty%2Fxfsprogs-dev.git xfs_db: fix leak in flist_find_ftyp() 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 Reviewed-by: Bill O'Donnell Reviewed-by: Christoph Hellwig Signed-off-by: Andrey Albershteyn --- diff --git a/db/flist.c b/db/flist.c index c81d229a..0a6cc5fc 100644 --- a/db/flist.c +++ b/db/flist.c @@ -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;