[vlc-devel] commit: Help to fight NULL pointer dereference in stats ( Rafaël Carré )

git version control git at videolan.org
Fri May 23 15:51:33 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri May 23 15:52:20 2008 +0200| [001bc3d2a10b58ef03c5172a0632d69adb4a990e]

Help to fight NULL pointer dereference in stats

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=001bc3d2a10b58ef03c5172a0632d69adb4a990e
---

 src/misc/stats.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/misc/stats.c b/src/misc/stats.c
index 45ff1ce..db058b2 100644
--- a/src/misc/stats.c
+++ b/src/misc/stats.c
@@ -32,6 +32,8 @@
 #include <vlc/vlc.h>
 #include <stdio.h>                                               /* required */
 
+#include <assert.h>
+
 #include "input/input_internal.h"
 
 /*****************************************************************************
@@ -376,6 +378,7 @@ void __stats_TimerDump( vlc_object_t *p_obj, unsigned int i_id )
             break;
         }
     }
+    assert( p_counter );
     TimerDump( p_obj, p_counter, true );
     vlc_mutex_unlock( &priv->timer_lock );
 }
@@ -581,9 +584,11 @@ static int CounterUpdate( vlc_object_t *p_handler,
 static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter,
                        bool b_total )
 {
+    assert( p_counter );
+
     mtime_t last, 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 );
         return;




More information about the vlc-devel mailing list