[warnings] fix dead store warnings

This commit is contained in:
akallabeth 2024-09-12 09:35:11 +02:00
parent c9b0c9ecd5
commit e00661d338
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
10 changed files with 64 additions and 31 deletions

View File

@ -1637,7 +1637,8 @@ int main(int argc, char* argv[])
if (freerdp_client_stop(context) != 0)
return -1;
rc = sdl->exit_code;
if (sdl->exit_code != 0)
rc = sdl->exit_code;
return rc;
}

View File

@ -1153,8 +1153,6 @@ static void sdl_post_final_disconnect(freerdp* instance)
if (!instance->context)
return;
auto context = get_context(instance->context);
}
/* RDP main loop.
@ -1624,7 +1622,8 @@ int main(int argc, char* argv[])
if (freerdp_client_stop(context) != 0)
return -1;
rc = sdl->exit_code;
if (sdl->exit_code != 0)
rc = sdl->exit_code;
return rc;
}

View File

@ -363,7 +363,6 @@ BOOL rdp_send_client_persistent_key_list_pdu(rdpRdp* rdp)
info.numEntriesCache3 = MIN(keyCount, info.totalEntriesCache3);
keyCount -= info.numEntriesCache3;
info.numEntriesCache4 = MIN(keyCount, info.totalEntriesCache4);
keyCount -= info.numEntriesCache4;
info.totalEntriesCache0 = info.numEntriesCache0;
info.totalEntriesCache1 = info.numEntriesCache1;

View File

@ -463,6 +463,8 @@ int credssp_auth_authenticate(rdpCredsspAuth* auth)
WINPR_ASSERT(auth->table->QueryContextAttributes);
status =
auth->table->QueryContextAttributes(&auth->context, SECPKG_ATTR_SIZES, &auth->sizes);
WLog_DBG(TAG, "QueryContextAttributes returned %s [0x%08" PRIx32 "]",
GetSecurityStatusString(status), status);
WLog_DBG(TAG, "Context sizes: cbMaxSignature=%d, cbSecurityTrailer=%d",
auth->sizes.cbMaxSignature, auth->sizes.cbSecurityTrailer);

View File

@ -94,6 +94,8 @@ static const char* client_in_state_str(CLIENT_IN_CHANNEL_STATE state)
case CLIENT_IN_CHANNEL_STATE_FINAL:
str = "CLIENT_IN_CHANNEL_STATE_FINAL";
break;
default:
break;
}
return str;
}
@ -143,6 +145,8 @@ static const char* client_out_state_str(CLIENT_OUT_CHANNEL_STATE state)
case CLIENT_OUT_CHANNEL_STATE_FINAL:
str = "CLIENT_OUT_CHANNEL_STATE_FINAL";
break;
default:
break;
}
return str;
}
@ -176,6 +180,8 @@ const char* rpc_vc_state_str(VIRTUAL_CONNECTION_STATE state)
case VIRTUAL_CONNECTION_STATE_FINAL:
str = "VIRTUAL_CONNECTION_STATE_FINAL";
break;
default:
break;
}
return str;
}

View File

@ -80,6 +80,8 @@ static const char* rpc_client_state_str(RPC_CLIENT_STATE state)
case RPC_CLIENT_STATE_FINAL:
str = "RPC_CLIENT_STATE_FINAL";
break;
default:
break;
}
return str;
}

View File

@ -1128,8 +1128,11 @@ static state_run_t peer_recv_callback_internal(rdpTransport* transport, wStream*
{
if (!rdp_server_transition_to_state(rdp, CONNECTION_STATE_ACTIVE))
ret = STATE_RUN_FAILED;
update_reset_state(rdp->update);
ret = STATE_RUN_CONTINUE;
else
{
update_reset_state(rdp->update);
ret = STATE_RUN_CONTINUE;
}
}
else
ret = peer_unexpected_client_message(rdp, FINALIZE_CS_FONT_LIST_PDU);

View File

@ -96,27 +96,21 @@
static char* gdi_convert_postfix_to_infix(const char* postfix)
{
size_t length = 0;
BOOL unary = 0;
wStack* stack = NULL;
size_t al = 0;
size_t bl = 0;
size_t cl = 0;
size_t dl = 0;
char* a = NULL;
char* b = NULL;
char* c = NULL;
char* d = NULL;
bl = cl = dl = 0;
stack = Stack_New(FALSE);
length = strlen(postfix);
wStack* stack = Stack_New(FALSE);
size_t length = strlen(postfix);
for (size_t i = 0; i < length; i++)
{
BOOL success = FALSE;
if ((postfix[i] == 'P') || (postfix[i] == 'D') || (postfix[i] == 'S'))
{
/* token is an operand, push on the stack */
a = malloc(2);
char* a = malloc(2);
if (!a)
goto end;
a[0] = postfix[i];
a[1] = '\0';
// printf("Operand: %s\n", a);
@ -126,7 +120,9 @@ static char* gdi_convert_postfix_to_infix(const char* postfix)
{
/* token is an operator */
unary = FALSE;
c = malloc(2);
char* c = malloc(2);
if (!c)
goto fail;
c[0] = postfix[i];
c[1] = '\0';
@ -153,11 +149,12 @@ static char* gdi_convert_postfix_to_infix(const char* postfix)
}
// printf("Operator: %s\n", c);
a = (char*)Stack_Pop(stack);
char* a = (char*)Stack_Pop(stack);
if (!a)
goto fail;
if (unary)
b = NULL;
else
char* b = NULL;
if (!unary)
b = (char*)Stack_Pop(stack);
al = strlen(a);
@ -165,20 +162,32 @@ static char* gdi_convert_postfix_to_infix(const char* postfix)
if (b)
bl = strlen(b);
cl = 1;
dl = al + bl + cl + 3;
d = malloc(dl + 1);
size_t cl = 1;
size_t dl = al + bl + cl + 3;
char* d = malloc(dl + 1);
if (!d)
goto fail;
(void)sprintf_s(d, dl, "(%s%s%s)", b ? b : "", c, a);
Stack_Push(stack, d);
success = TRUE;
fail:
free(a);
free(b);
free(c);
if (!success)
goto end;
}
}
d = (char*)Stack_Pop(stack);
char* d = (char*)Stack_Pop(stack);
Stack_Free(stack);
return d;
end:
Stack_Free(stack);
return NULL;
}
static const char* test_ROP3[] = { "DSPDxax", "PSDPxax", "SPna", "DSna", "DPa",

View File

@ -758,6 +758,8 @@ static SECURITY_STATUS NCryptP11EnumKeys(NCRYPT_PROV_HANDLE hProvider, LPCWSTR p
{
WINPR_ASSERT(provider->p11->C_CloseSession);
rv = provider->p11->C_CloseSession(currentSession);
if (rv != CKR_OK)
WLog_WARN(TAG, "C_CloseSession failed with 0x%08" PRIx32, rv);
currentSession = (CK_SESSION_HANDLE)NULL;
}
@ -818,6 +820,8 @@ static SECURITY_STATUS NCryptP11EnumKeys(NCRYPT_PROV_HANDLE hProvider, LPCWSTR p
cleanup_FindObjects:
WINPR_ASSERT(provider->p11->C_FindObjectsFinal);
rv = provider->p11->C_FindObjectsFinal(currentSession);
if (rv != CKR_OK)
WLog_ERR(TAG, "C_FindObjectsFinal failed with 0x%08" PRIx32, rv);
if (keyName)
{

View File

@ -63,11 +63,14 @@ bio_release:
int TestNCryptSmartcard(int argc, char* argv[])
{
SECURITY_STATUS status = 0;
int rc = -1;
DWORD providerCount = 0;
NCryptProviderName* names = NULL;
status = NCryptEnumStorageProviders(&providerCount, &names, NCRYPT_SILENT_FLAG);
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
SECURITY_STATUS status = NCryptEnumStorageProviders(&providerCount, &names, NCRYPT_SILENT_FLAG);
if (status != ERROR_SUCCESS)
return -1;
@ -149,8 +152,13 @@ int TestNCryptSmartcard(int argc, char* argv[])
NCryptFreeBuffer(enumState);
NCryptFreeObject((NCRYPT_HANDLE)provider);
if (status != NTE_NO_MORE_ITEMS)
goto fail;
}
rc = 0;
fail:
NCryptFreeBuffer(names);
return 0;
return rc;
}