parted/0018-filesys-Check-for-null-from-close_fn.patch

29 lines
885 B
Diff
Raw Normal View History

From c409dbf423d870ab26684cd6a6953c76c4a08d7f Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 15 Feb 2023 10:04:36 -0800
Subject: [PATCH 18/24] filesys: Check for null from close_fn
If the filesystem type name isn't known it can return a NULL.
---
libparted/fs/r/filesys.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libparted/fs/r/filesys.c b/libparted/fs/r/filesys.c
index 9dafd71..6e795bc 100644
--- a/libparted/fs/r/filesys.c
+++ b/libparted/fs/r/filesys.c
@@ -198,8 +198,9 @@ ped_file_system_close (PedFileSystem* fs)
{
PED_ASSERT (fs != NULL);
PedDevice *dev = fs->geom->dev;
+ close_fn_t fn = close_fn (fs->type->name);
- if (!(close_fn (fs->type->name) (fs)))
+ if (!fn || !(fn (fs)))
goto error_close_dev;
ped_device_close (dev);
return 1;
--
2.39.2