diff options
author | Tux3 / Mlkj / !Lev.uXFMLA <tux3@users.noreply.github.com> | 2014-06-18 21:33:11 +0200 |
---|---|---|
committer | Tux3 / Mlkj / !Lev.uXFMLA <tux3@users.noreply.github.com> | 2014-06-18 21:33:11 +0200 |
commit | 78bd8b3f179219b6824555449e1439b76d2196fe (patch) | |
tree | 0b339d1c092a1a6e16da8cc8dd057b9e50f3b905 | |
parent | 888ebea619e3068fce10508c9187b7d2c81c2c17 (diff) |
Fix possible nullptr dereferences in toxav/msi.c
-rw-r--r-- | toxav/msi.c | 12 |
1 files 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 ) | |||
928 | 928 | ||
929 | 929 | ||
930 | MSICall *_call = session->calls[_call_idx]; | 930 | MSICall *_call = session->calls[_call_idx]; |
931 | _call->call_idx = _call_idx; | ||
932 | 931 | ||
933 | if ( _call == NULL ) { | 932 | if ( _call == NULL ) { |
934 | LOGGER_WARNING("Allocation failed!"); | 933 | LOGGER_WARNING("Allocation failed!"); |
935 | return NULL; | 934 | return NULL; |
936 | } | 935 | } |
937 | 936 | ||
937 | _call->call_idx = _call_idx; | ||
938 | _call->type_peer = calloc ( sizeof ( MSICallType ), peers ); | 938 | _call->type_peer = calloc ( sizeof ( MSICallType ), peers ); |
939 | 939 | ||
940 | if ( _call->type_peer == NULL ) { | 940 | if ( _call->type_peer == NULL ) { |
@@ -1026,9 +1026,11 @@ void *handle_timeout ( void *arg ) | |||
1026 | */ | 1026 | */ |
1027 | MSICall *_call = arg; | 1027 | MSICall *_call = arg; |
1028 | 1028 | ||
1029 | LOGGER_DEBUG("[Call: %s] Request timed out!", _call->id); | 1029 | if (_call) { |
1030 | 1030 | LOGGER_DEBUG("[Call: %s] Request timed out!", _call->id); | |
1031 | invoke_callback(_call->call_idx, MSI_OnRequestTimeout); | 1031 | |
1032 | invoke_callback(_call->call_idx, MSI_OnRequestTimeout); | ||
1033 | } | ||
1032 | 1034 | ||
1033 | if ( _call && _call->session ) { | 1035 | if ( _call && _call->session ) { |
1034 | 1036 | ||