parted/0018-filesys-Check-for-null-from-close_fn.patch
Brian C. Lane d747d1a8fe - parted: Fix ending sector location when using kibi IEC suffix (bcl)
- tests: Fix formatting and snprintf warnings in tests. (bcl)
- ui: Add checks for prompt being NULL (bcl)
- strlist: Handle realloc error in wchar_to_str (bcl)
- libparted: Fix potential NULL dereference in ped_disk_next_partition (bcl)
- filesys: Check for null from close_fn (bcl)
2023-03-20 09:51:40 -07:00

29 lines
885 B
Diff

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