]> git.sesse.net Git - vlc/commitdiff
- fix invalid free of root object
authorRémi Denis-Courmont <rem@videolan.org>
Sat, 16 Apr 2005 12:24:32 +0000 (12:24 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sat, 16 Apr 2005 12:24:32 +0000 (12:24 +0000)
src/misc/objects.c

index c7c1f1be3257069cc6c60382d06d04c1a87ba557..b439120951a6d6f44d980f2e0f2326506a406eaf 100644 (file)
@@ -244,7 +244,8 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
 
     if( !p_new->p_vars )
     {
-        free( p_new );
+        if( i_type != VLC_OBJECT_ROOT )
+            free( p_new );
         return NULL;
     }
 
@@ -396,7 +397,9 @@ void __vlc_object_destroy( vlc_object_t *p_this )
     vlc_mutex_destroy( &p_this->object_lock );
     vlc_cond_destroy( &p_this->object_wait );
 
-    free( p_this );
+    /* root is not dynamically allocated by vlc_object_create */
+    if( p_this->i_object_type != VLC_OBJECT_ROOT )
+        free( p_this );
 }
 
 /**