mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
sftp: Do not overwrite errors set by channel functions
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 3784226fd8)
This commit is contained in:
@@ -127,22 +127,26 @@ sftp_session sftp_new(ssh_session session)
|
|||||||
|
|
||||||
sftp->ext = sftp_ext_new();
|
sftp->ext = sftp_ext_new();
|
||||||
if (sftp->ext == NULL) {
|
if (sftp->ext == NULL) {
|
||||||
|
ssh_set_error_oom(session);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
sftp->read_packet = calloc(1, sizeof(struct sftp_packet_struct));
|
sftp->read_packet = calloc(1, sizeof(struct sftp_packet_struct));
|
||||||
if (sftp->read_packet == NULL) {
|
if (sftp->read_packet == NULL) {
|
||||||
|
ssh_set_error_oom(session);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
sftp->read_packet->payload = ssh_buffer_new();
|
sftp->read_packet->payload = ssh_buffer_new();
|
||||||
if (sftp->read_packet->payload == NULL) {
|
if (sftp->read_packet->payload == NULL) {
|
||||||
|
ssh_set_error_oom(session);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
sftp->session = session;
|
sftp->session = session;
|
||||||
sftp->channel = ssh_channel_new(session);
|
sftp->channel = ssh_channel_new(session);
|
||||||
if (sftp->channel == NULL) {
|
if (sftp->channel == NULL) {
|
||||||
|
ssh_set_error_oom(session);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +160,6 @@ sftp_session sftp_new(ssh_session session)
|
|||||||
|
|
||||||
return sftp;
|
return sftp;
|
||||||
error:
|
error:
|
||||||
ssh_set_error_oom(session);
|
|
||||||
if (sftp->ext != NULL) {
|
if (sftp->ext != NULL) {
|
||||||
sftp_ext_free(sftp->ext);
|
sftp_ext_free(sftp->ext);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user