Commit 001bc3d2 authored by Rafaël Carré's avatar Rafaël Carré

Help to fight NULL pointer dereference in stats

parent c3c3d074
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <stdio.h> /* required */ #include <stdio.h> /* required */
#include <assert.h>
#include "input/input_internal.h" #include "input/input_internal.h"
/***************************************************************************** /*****************************************************************************
...@@ -376,6 +378,7 @@ void __stats_TimerDump( vlc_object_t *p_obj, unsigned int i_id ) ...@@ -376,6 +378,7 @@ void __stats_TimerDump( vlc_object_t *p_obj, unsigned int i_id )
break; break;
} }
} }
assert( p_counter );
TimerDump( p_obj, p_counter, true ); TimerDump( p_obj, p_counter, true );
vlc_mutex_unlock( &priv->timer_lock ); vlc_mutex_unlock( &priv->timer_lock );
} }
...@@ -581,9 +584,11 @@ static int CounterUpdate( vlc_object_t *p_handler, ...@@ -581,9 +584,11 @@ static int CounterUpdate( vlc_object_t *p_handler,
static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter, static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter,
bool b_total ) bool b_total )
{ {
assert( p_counter );
mtime_t last, total; mtime_t last, total;
int i_total; int i_total;
if( !p_counter || p_counter->i_samples != 2 ) if( p_counter->i_samples != 2 )
{ {
msg_Err( p_obj, "timer %s does not exist", p_counter->psz_name ); msg_Err( p_obj, "timer %s does not exist", p_counter->psz_name );
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment