From 7c1aa26a289f18ce5dda6021166d7fcfedcb8911 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 14 Feb 2016 17:54:07 +0100 Subject: call: move CALL_EVENT_ESTABLISHED to the end - since the callback handler might destroy the call object, it is safer to call the handler as the last thing in the function. otherwise the call object might be corrupt, i.e. pointing to deallocated memory. --- src/call.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/call.c b/src/call.c index 1ddb42f..dda9f3a 100644 --- a/src/call.c +++ b/src/call.c @@ -1028,14 +1028,15 @@ static void sipsess_estab_handler(const struct sip_msg *msg, void *arg) set_state(call, STATE_ESTABLISHED); - call_event_handler(call, CALL_EVENT_ESTABLISHED, call->peer_uri); - call_stream_start(call, true); /* the transferor will hangup this call */ if (call->not) { (void)call_notify_sipfrag(call, 200, "OK"); } + + /* must be done last, the handler might deref this call */ + call_event_handler(call, CALL_EVENT_ESTABLISHED, call->peer_uri); } -- cgit v1.2.1