Handle out-of-memory condition in sized_string_new.
@@ -115,6 +115,9 @@ SIZED_STRING* sized_string_new(
result = (SIZED_STRING*) yr_malloc(sizeof(SIZED_STRING) + length);
+ if (result == NULL)
+ return NULL;
+
result->length = length;
result->flags = 0;
@@ -134,7 +137,10 @@ SIZED_STRING* sized_string_convert_to_wide(
{
size_t i;
size_t j = 0;
- SIZED_STRING* wide = (SIZED_STRING*) yr_malloc(sizeof(SIZED_STRING) + s->length * 2);
+
+ SIZED_STRING* wide = (SIZED_STRING*) yr_malloc(
+ sizeof(SIZED_STRING) + s->length * 2);
+
if (wide == NULL)
return NULL;
