From e4ec2e10438204b2ec8bd2f6db91224f017b9a35 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 26 Feb 2021 21:44:30 +0300 Subject: [PATCH] [mod_spandsp] scan-build: Argument with 'nonnull' attribute passed null in modem_init() --- src/mod/applications/mod_spandsp/mod_spandsp_modem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index 5613b4aa4c..560a78be44 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -279,11 +279,11 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl modem->stty = ptsname(modem->master); if (modem->stty == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to obtain slave pty filename\n"); - } - - modem->slave = open(modem->stty, O_RDWR); - if (modem->slave < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to open slave pty %s\n", modem->stty); + } else { + modem->slave = open(modem->stty, O_RDWR); + if (modem->slave < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to open slave pty %s\n", modem->stty); + } } #endif