core/nla: Fix leak found by covscan
leaked_storage: Variable "s" going out of scope leaks the storage it points to.
@@ -1886,24 +1886,33 @@ BOOL nla_send(rdpNla* nla)
nla->negoToken.cbBuffer); /* OCTET STRING */
if (length != nego_tokens_length)
+ {
+ Stream_Free(s, TRUE);
return FALSE;
}
+ }
/* [2] authInfo (OCTET STRING) */
if (auth_info_length > 0)
{
if (ber_write_sequence_octet_string(s, 2, nla->authInfo.pvBuffer,
nla->authInfo.cbBuffer) != auth_info_length)
+ {
+ Stream_Free(s, TRUE);
return FALSE;
}
+ }
/* [3] pubKeyAuth (OCTET STRING) */
if (pub_key_auth_length > 0)
{
if (ber_write_sequence_octet_string(s, 3, nla->pubKeyAuth.pvBuffer,
nla->pubKeyAuth.cbBuffer) != pub_key_auth_length)
+ {
+ Stream_Free(s, TRUE);
return FALSE;
}
+ }
/* [4] errorCode (INTEGER) */
if (error_code_length > 0)
@@ -1917,8 +1926,11 @@ BOOL nla_send(rdpNla* nla)
{
if (ber_write_sequence_octet_string(s, 5, nla->ClientNonce.pvBuffer,
nla->ClientNonce.cbBuffer) != client_nonce_length)
+ {
+ Stream_Free(s, TRUE);
return FALSE;
}
+ }
Stream_SealLength(s);
transport_write(nla->transport, s);
