1
1

messages: Some cleanup for ssh_packet_service_request

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Andreas Schneider 2018-09-25 16:00:26 +02:00
родитель 54ec81db2d
Коммит bc72ec5821

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

@ -613,28 +613,27 @@ void ssh_message_free(ssh_message msg){
SSH_PACKET_CALLBACK(ssh_packet_service_request)
{
ssh_string service = NULL;
char *service_c = NULL;
ssh_message msg = NULL;
int rc;
(void)type;
(void)user;
service = ssh_buffer_get_ssh_string(packet);
if (service == NULL) {
rc = ssh_buffer_unpack(packet,
"s",
&service_c);
if (rc != SSH_OK) {
ssh_set_error(session,
SSH_FATAL,
"Invalid SSH_MSG_SERVICE_REQUEST packet");
goto error;
}
service_c = ssh_string_to_char(service);
if (service_c == NULL) {
goto error;
}
SSH_LOG(SSH_LOG_PACKET,
"Received a SERVICE_REQUEST for service %s",
service_c);
msg = ssh_message_new(session);
if (msg == NULL) {
SAFE_FREE(service_c);
@ -643,11 +642,9 @@ SSH_PACKET_CALLBACK(ssh_packet_service_request)
msg->type = SSH_REQUEST_SERVICE;
msg->service_request.service = service_c;
error:
ssh_string_free(service);
if (msg != NULL) {
ssh_message_queue(session, msg);
}
error:
return SSH_PACKET_USED;
}