[parted-devel] [PATCH 3/5] strlist: Handle realloc error in wchar_to_str
Brian C. Lane
bcl at redhat.com
Wed Feb 15 19:57:09 GMT 2023
It could return a NULL if the realloc fails. This handles the failure in
the same way as other failures in wchar_to_str, it exits immediately
with an error message.
---
parted/strlist.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/parted/strlist.c b/parted/strlist.c
index 71cba59..7901789 100644
--- a/parted/strlist.c
+++ b/parted/strlist.c
@@ -166,6 +166,8 @@ wchar_to_str (const wchar_t* str, size_t count)
goto error;
result = realloc (result, strlen (result) + 1);
+ if (!result)
+ goto error;
return result;
error:
--
2.39.1
More information about the parted-devel
mailing list