summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxav/msi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/toxav/msi.c b/toxav/msi.c
index c08c0135..2115a2d0 100644
--- a/toxav/msi.c
+++ b/toxav/msi.c
@@ -154,9 +154,11 @@ int msi_kill (MSISession *session)
154 154
155 MSICall *it = get_call(session, session->calls_head); 155 MSICall *it = get_call(session, session->calls_head);
156 156
157 for (; it; it = it->next) { 157 while (it) {
158 send_message(session->messenger, it->friend_number, &msg); 158 send_message(session->messenger, it->friend_number, &msg);
159 kill_call(it); /* This will eventually free session->calls */ 159 MSICall *temp_it = it;
160 it = it->next;
161 kill_call(temp_it); /* This will eventually free session->calls */
160 } 162 }
161 } 163 }
162 164