in src/fabric_string_list_result.c [26:83]
FABRIC_STRING_LIST_RESULT_HANDLE fabric_string_list_result_create(ULONG nStrings, const wchar_t** strings)
{
FABRIC_STRING_LIST_RESULT_HANDLE result;
if (strings == NULL)
{
LogError("invalid argument ULONG nStrings=%" PRIu32 ", const wchar_t** strings=%p",
nStrings, strings);
result = NULL;
}
else
{
result = malloc_flex(sizeof(FABRIC_STRING_LIST_RESULT), nStrings, sizeof(wchar_t*));
if (result == NULL)
{
LogError("failure in malloc_flex");
}
else
{
ULONG i;
bool wasError = false;
for (i = 0; !wasError && (i < nStrings); i++)
{
result->strings[i] = sprintf_wchar(L"%ls", strings[i]); /*can be made missing with enough smartnesses*/
if (result->strings[i] == NULL)
{
LogError("failire in sprintf_wchar");
wasError = true;
}
else
{
/*keep going*/
}
}
if (wasError)
{
ULONG j;
for (j = 0; j < i; j++)
{
free(result->strings[j]);
}
}
else
{
result->nstrings = nStrings;
goto allok;
}
free(result);
result = NULL;
}
}
allok:;
return result;
}