Use freerdp_settings_set_pointer_len instead of calloc

This commit is contained in:
Armin Novak 2021-10-18 14:13:22 +02:00 committed by akallabeth
parent 0848ad1a71
commit be0433a1fb
1 changed files with 5 additions and 6 deletions

View File

@ -1345,9 +1345,8 @@ BOOL gcc_read_server_security_data(wStream* s, rdpMcs* mcs)
return FALSE;
/* serverRandom */
settings->ServerRandom = (BYTE*)malloc(settings->ServerRandomLength);
if (!settings->ServerRandom)
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_ServerRandom, NULL,
settings->ServerRandomLength))
goto fail;
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
@ -1356,12 +1355,12 @@ BOOL gcc_read_server_security_data(wStream* s, rdpMcs* mcs)
goto fail;
/* serverCertificate */
settings->ServerCertificate = (BYTE*)malloc(settings->ServerCertificateLength);
if (!settings->ServerCertificate)
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_ServerCertificate, NULL,
settings->ServerCertificateLength))
goto fail;
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerCertificate, certificate_new(),
sizeof(rdpCertificate)))
goto fail;