summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2023-02-15 10:32:59 -0800
committerBrian C. Lane <bcl@redhat.com>2023-02-15 10:34:49 -0800
commit9cb38a7444d02023d112ae8e9e38436104f75f64 (patch)
tree4d40d8aa683d110a9159b4e77d25d5d6e031a6b8
parent31db44c74a96f8e2b495205d18525449e9b29543 (diff)
downloadparted-9cb38a7444d02023d112ae8e9e38436104f75f64.tar.gz
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.
-rw-r--r--parted/strlist.c2
1 files changed, 2 insertions, 0 deletions
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: