]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_dingaling] scan-build: fix multiple dead assignments and dereference of null... mod_dingaling 406/head
authorAndrey Volk <andywolk@gmail.com>
Fri, 21 Feb 2020 20:33:13 +0000 (00:33 +0400)
committerAndrey Volk <andywolk@gmail.com>
Fri, 21 Feb 2020 20:46:10 +0000 (00:46 +0400)
libs/libdingaling/src/libdingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c

index 8efe5c4af5389c139383fcefb24e01cb4d0c2f7d..07e70d0c502470f66af328a7a026426772bcb313 100644 (file)
@@ -499,7 +499,10 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from,
                                                unsigned int *candidate_len = NULL;
                                                ldl_candidate_t (*candidates)[LDL_MAX_CANDIDATES] = NULL;
                                                
-                                               if ((key = iks_find_attrib(tag, "preference"))) {
+                                               if (!(key = iks_find_attrib(tag, "preference"))) {
+                                                       globals.logger(DL_LOG_WARNING, "Field preference was not set\n");
+                                                       continue;
+                                               } else {
                                                        unsigned int x;
                                                        
                                                        pref = strtod(key, NULL);
@@ -936,10 +939,10 @@ static int on_disco_default(void *user_data, ikspak *pak)
                node = iks_find_attrib(pak->query, "node");
        }
 
-       if (pak->subtype == IKS_TYPE_RESULT) {
+       if (pak && pak->subtype == IKS_TYPE_RESULT) {
                globals.logger(DL_LOG_CRIT, "FixME!!! node=[%s]\n", node?node:"");              
-       } else if (pak->subtype == IKS_TYPE_GET) {
-               if ((iq = iks_new("iq"))) {
+       } else if (pak && pak->subtype == IKS_TYPE_GET) {
+               if (ns && (iq = iks_new("iq"))) {
                        int all = 0;
                        
                        iks_insert_attrib(iq, "from", handle->login);
@@ -1081,7 +1084,6 @@ static int on_presence(void *user_data, ikspak *pak)
                        if (ext && strstr(ext, "voice-v1") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) {
                                apr_cpystrn(buffer->buf, from, buffer->len);
                                buffer->hit = 1;
-                               done = 1;
                        }
                }
        }
@@ -1149,7 +1151,6 @@ static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from
        
        bytes = read(fd, image, sizeof(image));
        close(fd);
-       fd = -1;
 
        ap = malloc(sizeof(*ap));
        assert(ap != NULL);
@@ -2565,7 +2566,6 @@ unsigned int ldl_session_candidates(ldl_session_t *session,
                iq = NULL;
                sess = NULL;
                tag = NULL;
-               x = 0;
                id = 0;
        }
 
index 8ab56c5da107356e48d1741c7a030498f01f29a3..99a65874096debb50c69e89d90b2a616aff677d9 100644 (file)
@@ -680,7 +680,6 @@ static void roster_event_handler(switch_event_t *event)
 {
        char *status = switch_event_get_header(event, "status");
        char *from = switch_event_get_header(event, "from");
-       char *event_type = switch_event_get_header(event, "event_type");
        mdl_profile_t *profile = NULL;
        switch_hash_index_t *hi;
        void *val;
@@ -694,10 +693,6 @@ static void roster_event_handler(switch_event_t *event)
                status = NULL;
        }
 
-       if (zstr(event_type)) {
-               event_type = "presence";
-       }
-
        if (from) {
                sql = switch_mprintf("select *,'%q' from jabber_subscriptions where sub_from='%q'", status ? status : "", from);
        } else {
@@ -4429,11 +4424,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                break;
        case LDL_SIGNAL_CANDIDATES:
                if (dl_signal) {
-                       status = LDL_STATUS_SUCCESS;
-
-                       status = parse_candidates(dlsession, session, LDL_TPORT_RTP, subject);
-                       status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject);
-                       status = parse_candidates(dlsession, session, LDL_TPORT_RTCP, subject);
+                       parse_candidates(dlsession, session, LDL_TPORT_RTP, subject);
+                       parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject);
+                       parse_candidates(dlsession, session, LDL_TPORT_RTCP, subject);
                        status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTCP, subject);
                }