aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libssh/channels1.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libssh/channels1.c b/libssh/channels1.c
index b749be45..1d360398 100644
--- a/libssh/channels1.c
+++ b/libssh/channels1.c
@@ -190,11 +190,8 @@ int channel_request_exec1(CHANNEL *channel, const char *cmd) {
return -1;
}
- if (buffer_add_u8(session->out_buffer, SSH_CMSG_EXEC_CMD) < 0) {
- string_free(command);
- return -1;
- }
- if (buffer_add_ssh_string(session->out_buffer, command) < 0) {
+ if (buffer_add_u8(session->out_buffer, SSH_CMSG_EXEC_CMD) < 0 ||
+ buffer_add_ssh_string(session->out_buffer, command) < 0) {
string_free(command);
return -1;
}