From 78bd8b3f179219b6824555449e1439b76d2196fe Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Wed, 18 Jun 2014 21:33:11 +0200 Subject: Fix possible nullptr dereferences in toxav/msi.c --- toxav/msi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/toxav/msi.c b/toxav/msi.c index 6a529699..8476c5be 100644 --- a/toxav/msi.c +++ b/toxav/msi.c @@ -928,13 +928,13 @@ MSICall *init_call ( MSISession *session, int peers, int ringing_timeout ) MSICall *_call = session->calls[_call_idx]; - _call->call_idx = _call_idx; if ( _call == NULL ) { LOGGER_WARNING("Allocation failed!"); return NULL; } - + + _call->call_idx = _call_idx; _call->type_peer = calloc ( sizeof ( MSICallType ), peers ); if ( _call->type_peer == NULL ) { @@ -1026,9 +1026,11 @@ void *handle_timeout ( void *arg ) */ MSICall *_call = arg; - LOGGER_DEBUG("[Call: %s] Request timed out!", _call->id); - - invoke_callback(_call->call_idx, MSI_OnRequestTimeout); + if (_call) { + LOGGER_DEBUG("[Call: %s] Request timed out!", _call->id); + + invoke_callback(_call->call_idx, MSI_OnRequestTimeout); + } if ( _call && _call->session ) { -- cgit v1.2.3