]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] coverity CID 1024249 (Dereference before null check)
authorDragos Oancea <dragos@signalwire.com>
Wed, 31 May 2023 13:17:18 +0000 (16:17 +0300)
committerAndrey Volk <andywolk@gmail.com>
Wed, 31 May 2023 21:43:06 +0000 (00:43 +0300)
src/mod/endpoints/mod_sofia/sofia_glue.c

index 0eb0dcf601ea4e9d165bcb90a283546edbf3ffeb..eceae218f8d55be2058e785529ed1fc7b7d3b55f 100644 (file)
@@ -2282,8 +2282,7 @@ int sofia_recover_callback(switch_core_session_t *session)
        switch_channel_t *channel = switch_core_session_get_channel(session);
        private_object_t *tech_pvt = NULL;
        sofia_profile_t *profile = NULL;
-       const char *tmp;
-       const char *rr;
+       const char *tmp, *rr, *use_uuid;
        int r = 0;
        const char *profile_name = switch_channel_get_variable_dup(channel, "recovery_profile_name", SWITCH_FALSE, -1);
        int swap = switch_channel_var_true(channel, "dlg_req_swap_direction");
@@ -2374,17 +2373,13 @@ int sofia_recover_callback(switch_core_session_t *session)
                                                                                   );
        }
 
-       if (session) {
-               const char *use_uuid;
-
-               if ((use_uuid = switch_channel_get_variable(channel, "origination_uuid"))) {
-                       if (switch_core_session_set_uuid(session, use_uuid) == SWITCH_STATUS_SUCCESS) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(channel),
-                                                                 use_uuid);
-                       } else {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s set UUID=%s FAILED\n",
-                                                                 switch_channel_get_name(channel), use_uuid);
-                       }
+       if ((use_uuid = switch_channel_get_variable(channel, "origination_uuid"))) {
+               if (switch_core_session_set_uuid(session, use_uuid) == SWITCH_STATUS_SUCCESS) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(channel),
+                                                         use_uuid);
+               } else {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s set UUID=%s FAILED\n",
+                                                         switch_channel_get_name(channel), use_uuid);
                }
        }