From 1d91699e8e23dab4c221c8402c7f086264a485ee Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 15 Dec 2015 15:12:38 -0500 Subject: Fixed use of it after free. --- toxav/msi.c | 6 ++++-- 1 file 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) MSICall *it = get_call(session, session->calls_head); - for (; it; it = it->next) { + while (it) { send_message(session->messenger, it->friend_number, &msg); - kill_call(it); /* This will eventually free session->calls */ + MSICall *temp_it = it; + it = it->next; + kill_call(temp_it); /* This will eventually free session->calls */ } } -- cgit v1.2.3