mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 18:04:25 +09:00
sftpserver: Use SSH_STRING_FREE()
Fixes T183 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -277,8 +277,8 @@ void sftp_client_message_free(sftp_client_message msg) {
|
|||||||
|
|
||||||
SAFE_FREE(msg->filename);
|
SAFE_FREE(msg->filename);
|
||||||
SAFE_FREE(msg->submessage);
|
SAFE_FREE(msg->submessage);
|
||||||
ssh_string_free(msg->data);
|
SSH_STRING_FREE(msg->data);
|
||||||
ssh_string_free(msg->handle);
|
SSH_STRING_FREE(msg->handle);
|
||||||
sftp_attributes_free(msg->attr);
|
sftp_attributes_free(msg->attr);
|
||||||
ssh_buffer_free(msg->complete_message);
|
ssh_buffer_free(msg->complete_message);
|
||||||
SAFE_FREE(msg->str_data);
|
SAFE_FREE(msg->str_data);
|
||||||
@@ -309,11 +309,11 @@ int sftp_reply_name(sftp_client_message msg, const char *name,
|
|||||||
buffer_add_attributes(out, attr) < 0 ||
|
buffer_add_attributes(out, attr) < 0 ||
|
||||||
sftp_packet_write(msg->sftp, SSH_FXP_NAME, out) < 0) {
|
sftp_packet_write(msg->sftp, SSH_FXP_NAME, out) < 0) {
|
||||||
ssh_buffer_free(out);
|
ssh_buffer_free(out);
|
||||||
ssh_string_free(file);
|
SSH_STRING_FREE(file);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ssh_buffer_free(out);
|
ssh_buffer_free(out);
|
||||||
ssh_string_free(file);
|
SSH_STRING_FREE(file);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -368,27 +368,27 @@ int sftp_reply_names_add(sftp_client_message msg, const char *file,
|
|||||||
if (msg->attrbuf == NULL) {
|
if (msg->attrbuf == NULL) {
|
||||||
msg->attrbuf = ssh_buffer_new();
|
msg->attrbuf = ssh_buffer_new();
|
||||||
if (msg->attrbuf == NULL) {
|
if (msg->attrbuf == NULL) {
|
||||||
ssh_string_free(name);
|
SSH_STRING_FREE(name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssh_buffer_add_ssh_string(msg->attrbuf, name) < 0) {
|
if (ssh_buffer_add_ssh_string(msg->attrbuf, name) < 0) {
|
||||||
ssh_string_free(name);
|
SSH_STRING_FREE(name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_string_free(name);
|
SSH_STRING_FREE(name);
|
||||||
name = ssh_string_from_char(longname);
|
name = ssh_string_from_char(longname);
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ssh_buffer_add_ssh_string(msg->attrbuf,name) < 0 ||
|
if (ssh_buffer_add_ssh_string(msg->attrbuf,name) < 0 ||
|
||||||
buffer_add_attributes(msg->attrbuf,attr) < 0) {
|
buffer_add_attributes(msg->attrbuf,attr) < 0) {
|
||||||
ssh_string_free(name);
|
SSH_STRING_FREE(name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ssh_string_free(name);
|
SSH_STRING_FREE(name);
|
||||||
msg->attr_num++;
|
msg->attr_num++;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -444,12 +444,12 @@ int sftp_reply_status(sftp_client_message msg, uint32_t status,
|
|||||||
ssh_buffer_add_u32(out, 0) < 0 || /* language string */
|
ssh_buffer_add_u32(out, 0) < 0 || /* language string */
|
||||||
sftp_packet_write(msg->sftp, SSH_FXP_STATUS, out) < 0) {
|
sftp_packet_write(msg->sftp, SSH_FXP_STATUS, out) < 0) {
|
||||||
ssh_buffer_free(out);
|
ssh_buffer_free(out);
|
||||||
ssh_string_free(s);
|
SSH_STRING_FREE(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_buffer_free(out);
|
ssh_buffer_free(out);
|
||||||
ssh_string_free(s);
|
SSH_STRING_FREE(s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user