1
1

message: Use SSH_STRING_FREE()

Fixes T183

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Этот коммит содержится в:
Andreas Schneider 2019-10-31 09:42:10 +01:00
родитель d7abfe7e8f
Коммит 5db5e7e527

Просмотреть файл

@ -715,7 +715,7 @@ static ssh_buffer ssh_msg_userauth_build_digest(ssh_session session,
ssh_string_get_char(algo), /* pubkey algorithm */ ssh_string_get_char(algo), /* pubkey algorithm */
str); /* public key as a blob */ str); /* public key as a blob */
ssh_string_free(str); SSH_STRING_FREE(str);
if (rc != SSH_OK) { if (rc != SSH_OK) {
ssh_set_error_oom(session); ssh_set_error_oom(session);
ssh_buffer_free(buffer); ssh_buffer_free(buffer);
@ -800,7 +800,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
* 3.1. Initial Exchange * 3.1. Initial Exchange
* "The language tag is deprecated and SHOULD be the empty string." * "The language tag is deprecated and SHOULD be the empty string."
*/ */
ssh_string_free(lang); SSH_STRING_FREE(lang);
submethods = ssh_buffer_get_ssh_string(packet); submethods = ssh_buffer_get_ssh_string(packet);
if (submethods == NULL) { if (submethods == NULL) {
@ -812,7 +812,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
* server is that, unless the user may use multiple different * server is that, unless the user may use multiple different
* submethods, the server ignores this field." * submethods, the server ignores this field."
*/ */
ssh_string_free(submethods); SSH_STRING_FREE(submethods);
goto end; goto end;
} }
@ -835,10 +835,10 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
} }
rc = ssh_pki_import_pubkey_blob(pubkey_blob, &msg->auth_request.pubkey); rc = ssh_pki_import_pubkey_blob(pubkey_blob, &msg->auth_request.pubkey);
ssh_string_free(pubkey_blob); SSH_STRING_FREE(pubkey_blob);
pubkey_blob = NULL; pubkey_blob = NULL;
if (rc < 0) { if (rc < 0) {
ssh_string_free(algo); SSH_STRING_FREE(algo);
algo = NULL; algo = NULL;
goto error; goto error;
} }
@ -852,16 +852,16 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
if(sig_blob == NULL) { if(sig_blob == NULL) {
SSH_LOG(SSH_LOG_PACKET, "Invalid signature packet from peer"); SSH_LOG(SSH_LOG_PACKET, "Invalid signature packet from peer");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_ERROR; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_ERROR;
ssh_string_free(algo); SSH_STRING_FREE(algo);
algo = NULL; algo = NULL;
goto error; goto error;
} }
digest = ssh_msg_userauth_build_digest(session, msg, service, algo); digest = ssh_msg_userauth_build_digest(session, msg, service, algo);
ssh_string_free(algo); SSH_STRING_FREE(algo);
algo = NULL; algo = NULL;
if (digest == NULL) { if (digest == NULL) {
ssh_string_free(sig_blob); SSH_STRING_FREE(sig_blob);
SSH_LOG(SSH_LOG_PACKET, "Failed to get digest"); SSH_LOG(SSH_LOG_PACKET, "Failed to get digest");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG;
goto error; goto error;
@ -894,7 +894,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
ssh_buffer_get_len(digest)); ssh_buffer_get_len(digest));
} }
} }
ssh_string_free(sig_blob); SSH_STRING_FREE(sig_blob);
ssh_buffer_free(digest); ssh_buffer_free(digest);
ssh_signature_free(sig); ssh_signature_free(sig);
if (rc < 0) { if (rc < 0) {
@ -909,7 +909,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_VALID; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_VALID;
} }
ssh_string_free(algo); SSH_STRING_FREE(algo);
goto end; goto end;
} }
#ifdef WITH_GSSAPI #ifdef WITH_GSSAPI
@ -1097,7 +1097,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
goto error; goto error;
} }
session->kbdint->answers[i] = ssh_string_to_char(tmp); session->kbdint->answers[i] = ssh_string_to_char(tmp);
ssh_string_free(tmp); SSH_STRING_FREE(tmp);
if (session->kbdint->answers[i] == NULL) { if (session->kbdint->answers[i] == NULL) {
ssh_set_error_oom(session); ssh_set_error_oom(session);
session->kbdint->nanswers = i; session->kbdint->nanswers = i;