From 9cb38a7444d02023d112ae8e9e38436104f75f64 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 15 Feb 2023 10:32:59 -0800 Subject: strlist: Handle realloc error in wchar_to_str 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: -- cgit v1.2.1