[parted-devel] [PATCH 1/5] filesys: Check for null from close_fn
Brian C. Lane
bcl at redhat.com
Wed Feb 15 19:57:07 GMT 2023
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.1
More information about the parted-devel
mailing list