[warnings] fix missing NULL assert/check

This commit is contained in:
akallabeth 2024-09-11 23:09:34 +02:00
parent 2ae0c456b4
commit 8a990644c0
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
3 changed files with 7 additions and 1 deletions

View File

@ -4558,6 +4558,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
}
CommandLineSwitchCase(arg, "load-balance-info")
{
WINPR_ASSERT(arg->Value);
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_LoadBalanceInfo, arg->Value,
strlen(arg->Value)))
return fail_at(arg, COMMAND_LINE_ERROR);
@ -4761,6 +4762,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName),
TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName));
WINPR_ASSERT(arg->Value);
if (strncmp(TimeZoneKeyName, arg->Value, ARRAYSIZE(TimeZoneKeyName)) == 0)
{
found = TRUE;

View File

@ -44,7 +44,7 @@ int TestUri(int argc, char* argv[])
const char* cmp = input[i + 1];
int bTest = 0;
char* name = parse_uri_to_local_file(in, strlen(in));
if (name)
if (name && cmp)
{
bTest = !strcmp(name, cmp);
if (!bTest)

View File

@ -333,6 +333,10 @@ static BOOL copy(WCHAR** dst, ULONG* dstLen, const WCHAR* what, size_t len)
*dst = NULL;
*dstLen = 0;
if (!what && (len != 0))
return FALSE;
if (len == 0)
return TRUE;
*dst = calloc(sizeof(WCHAR), len + 1);
if (!*dst)
return FALSE;