From 98c0b8b164ab71dba612b056d51bddc49c4039fa Mon Sep 17 00:00:00 2001 From: Alexandre Bruyelles Date: Fri, 17 Nov 2023 01:11:02 +0100 Subject: [PATCH] filerec: fiemap_scan_extent: handle some errors Signed-off-by: Alexandre Bruyelles --- filerec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/filerec.c b/filerec.c index 554c3dd0c495..adaad48a1440 100644 --- a/filerec.c +++ b/filerec.c @@ -329,10 +329,17 @@ int fiemap_scan_extent(struct extent *extent) return ret; fiemap = do_fiemap(extent->e_file->fd); - if (!fiemap) + if (!fiemap) { + filerec_close(extent->e_file); return -1; + } result = get_extent(fiemap, extent->e_loff, NULL); + if (!extent) { + filerec_close(extent->e_file); + return -1; + } + extent->e_poff = result->fe_physical; filerec_close(extent->e_file); return ret;