[various] add proper return checks

This commit is contained in:
Armin Novak
2026-03-02 18:27:59 +01:00
parent b1e4933c78
commit 35831303ea
5 changed files with 33 additions and 25 deletions

View File

@@ -322,9 +322,10 @@ static char* arm_create_request_json(rdpArm* arm)
WINPR_JSON* json = WINPR_JSON_CreateObject();
if (!json)
goto arm_create_cleanup;
WINPR_JSON_AddStringToObject(
json, "application",
freerdp_settings_get_string(arm->context->settings, FreeRDP_RemoteApplicationProgram));
if (!WINPR_JSON_AddStringToObject(
json, "application",
freerdp_settings_get_string(arm->context->settings, FreeRDP_RemoteApplicationProgram)))
goto arm_create_cleanup;
lbi = calloc(
freerdp_settings_get_uint32(arm->context->settings, FreeRDP_LoadBalanceInfoLength) + 1,
@@ -339,9 +340,12 @@ static char* arm_create_request_json(rdpArm* arm)
len);
}
WINPR_JSON_AddStringToObject(json, "loadBalanceInfo", lbi);
WINPR_JSON_AddNullToObject(json, "LogonToken");
WINPR_JSON_AddNullToObject(json, "gatewayLoadBalancerToken");
if (!WINPR_JSON_AddStringToObject(json, "loadBalanceInfo", lbi))
goto arm_create_cleanup;
if (!WINPR_JSON_AddNullToObject(json, "LogonToken"))
goto arm_create_cleanup;
if (!WINPR_JSON_AddNullToObject(json, "gatewayLoadBalancerToken"))
goto arm_create_cleanup;
message = WINPR_JSON_PrintUnformatted(json);
arm_create_cleanup:

View File

@@ -593,7 +593,8 @@ static BOOL http_proxy_connect(rdpContext* context, BIO* bufferedBio, const char
const UINT32 timeout =
freerdp_settings_get_uint32(context->settings, FreeRDP_TcpConnectTimeout);
_itoa_s(port, port_str, sizeof(port_str), 10);
if (_itoa_s(port, port_str, sizeof(port_str), 10) < 0)
return FALSE;
hostLen = strlen(hostname);
portLen = strnlen(port_str, sizeof(port_str));