channels: Fix OOM error check after strdup

The fix allows the code to properly check if the strdup failed to allocate a
char buffer for the exit signal.

Signed-off-by: Antoni Bertolin Monferrer <antoni.monferrer@canonical.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Antoni Bertolin Monferrer
2025-12-11 21:42:16 +01:00
committed by Jakub Jelen
parent a7fd80795e
commit d45ce10c83

View File

@@ -3517,7 +3517,7 @@ int ssh_channel_get_exit_state(ssh_channel channel,
*pexit_signal = NULL; *pexit_signal = NULL;
if (channel->exit.signal != NULL) { if (channel->exit.signal != NULL) {
*pexit_signal = strdup(channel->exit.signal); *pexit_signal = strdup(channel->exit.signal);
if (pexit_signal == NULL) { if (*pexit_signal == NULL) {
ssh_set_error_oom(session); ssh_set_error_oom(session);
return SSH_ERROR; return SSH_ERROR;
} }