]> www.infradead.org Git - pidgin-chime.git/commitdiff
Fix clang static analysis warnings
authorIgnacio Casal Quinteiro <qignacio@amazon.com>
Fri, 22 Nov 2019 11:32:13 +0000 (12:32 +0100)
committerIgnacio Casal Quinteiro <qignacio@amazon.com>
Fri, 22 Nov 2019 11:35:34 +0000 (12:35 +0100)
Even though the code is ok better to deallocate the data
after it is removing it from the list, to avoid the warning
and to make the code clearer.

chime/chime-call-audio.c
prpl/messages.c

index 52c7469cdfb9be25f0de2464ae591b2bcbfc140e..ee43da9ca7d5f2a5a61864e15bb82bf3394c0c98 100644 (file)
@@ -466,8 +466,8 @@ static gboolean audio_receive_data_msg(ChimeCallAudio *audio, gconstpointer pkt,
                        if (m->msg_id >= audio->data_next_logical_msg)
                                break;
 
-                       free_msgbuf(m);
                        audio->data_messages = g_slist_remove(audio->data_messages, m);
+                       free_msgbuf(m);
                }
        }
  drop:
index 44390c3d4a211c95cba12acc84030d5e0b345ee7..54899a9950022df5ad828753eb6600a84447700a 100644 (file)
@@ -99,8 +99,8 @@ void chime_complete_messages(ChimeConnection *cxn, struct chime_msgs *msgs)
                        seen_one = TRUE;
                        msgs->cb(cxn, msgs, node, ms->tm.tv_sec);
                }
-               g_free(ms);
                l = g_list_remove(l, ms);
+               g_free(ms);
 
                /* Last message, note down the received time */
                if (!l && !msgs->msgs_failed && seen_one) {