aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-11-30 18:52:18 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-11-30 18:57:39 +0100
commit45172a70fac2f9407ca415733f41f6fc97956998 (patch)
tree8fc8acbe8dbb33cbb4ba9056d974f364fdb89a7f
parent7b0c80b475d79040822c98548df2feb3f3f701de (diff)
downloadlibssh-45172a70fac2f9407ca415733f41f6fc97956998.tar.gz
libssh-45172a70fac2f9407ca415733f41f6fc97956998.tar.xz
libssh-45172a70fac2f9407ca415733f41f6fc97956998.zip
sftp: Do not overwrite errors set by channel functions
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> (cherry picked from commit 3784226fd85bc1256ef927640f4d400348da038f)
-rw-r--r--src/sftp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sftp.c b/src/sftp.c
index 9dec687a..43eb1ad6 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -127,22 +127,26 @@ sftp_session sftp_new(ssh_session session)
sftp->ext = sftp_ext_new();
if (sftp->ext == NULL) {
+ ssh_set_error_oom(session);
goto error;
}
sftp->read_packet = calloc(1, sizeof(struct sftp_packet_struct));
if (sftp->read_packet == NULL) {
+ ssh_set_error_oom(session);
goto error;
}
sftp->read_packet->payload = ssh_buffer_new();
if (sftp->read_packet->payload == NULL) {
+ ssh_set_error_oom(session);
goto error;
}
sftp->session = session;
sftp->channel = ssh_channel_new(session);
if (sftp->channel == NULL) {
+ ssh_set_error_oom(session);
goto error;
}
@@ -156,7 +160,6 @@ sftp_session sftp_new(ssh_session session)
return sftp;
error:
- ssh_set_error_oom(session);
if (sftp->ext != NULL) {
sftp_ext_free(sftp->ext);
}