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


Reply via email to