]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_kazoo] scan-build: Argument with 'nonnull' attribute passed null in kz_endpoint_...
authorAndrey Volk <andywolk@gmail.com>
Thu, 1 Apr 2021 13:25:10 +0000 (16:25 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 19 Oct 2021 17:19:26 +0000 (20:19 +0300)
src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c

index cb2b28cb261f825bc1d511b011ce0558df8856d2..4ddfeddae4b587d61e9e3d9749e6baac0a511ace 100644 (file)
@@ -222,20 +222,20 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s
                }
 
                if (!call_fwd_is_valid) {
-                       dest = strdup(endpoint_dial);
+                       dest = endpoint_dial ? strdup(endpoint_dial) : strdup("");
                } else if (call_fwd_is_failover) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting failover => %s\n", callforward_dial);
-                       dest = strdup(endpoint_dial);
+                       dest = endpoint_dial ? strdup(endpoint_dial) : strdup("");
                        failover_dial = callforward_dial;
                } else if (call_fwd_is_substitute) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd substitute => %s\n", callforward_dial);
-                       dest = strdup(callforward_dial);
+                       dest = callforward_dial ? strdup(callforward_dial) : strdup("");
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd substitute => %s\n", dest);
                } else {
                        dest = switch_mprintf("%s%s%s", endpoint_dial ? endpoint_dial : "", (endpoint_dial ? endpoint_separator ? endpoint_separator : "," : ""), callforward_dial);
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd append => %s => %s\n", callforward_dial, dest);
                }
        } else {
-               dest = strdup(endpoint_dial);
+               dest = endpoint_dial ? strdup(endpoint_dial) : strdup("");
        }
 
        dialed_user = (char *)switch_xml_attr(x_user, "id");