]> git.sesse.net Git - vlc/commitdiff
vlc_arrays.h: Sanity check.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 1 Feb 2008 10:15:46 +0000 (10:15 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 1 Feb 2008 10:15:46 +0000 (10:15 +0000)
include/vlc_arrays.h

index 580bbd05c282e9b584e7f33dc0089179489bceb5..12b245ec8695f70f1eca10a05bf675e79288f040 100644 (file)
@@ -304,12 +304,14 @@ static inline void vlc_array_clear( vlc_array_t * p_array )
 static inline vlc_array_t * vlc_array_new( void )
 {
     vlc_array_t * ret = (vlc_array_t *)malloc( sizeof(vlc_array_t) );
-    vlc_array_init( ret );
+    if( ret ) vlc_array_init( ret );
     return ret;
 }
 
 static inline void vlc_array_destroy( vlc_array_t * p_array )
 {
+    if( !p_array )
+        return;
     vlc_array_clear( p_array );
     free( p_array );
 }