]> git.sesse.net Git - vlc/blobdiff - src/video_output/video_output.c
Fix massive leak when --vout-filter or --vout module_Need fails
[vlc] / src / video_output / video_output.c
index 506a56ec77032206487c80a0d378b95baa37c5a6..f4143f550e0f2bd1c3af032cd587d5433765992a 100644 (file)
@@ -487,6 +487,9 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
     if( p_vout->p_module == NULL )
     {
         msg_Err( p_vout, "no suitable vout module" );
+        spu_Attach( p_vout->p_spu, p_vout, false );
+        spu_Destroy( p_vout->p_spu );
+        p_vout->p_spu = NULL;
         vlc_object_release( p_vout );
         return NULL;
     }
@@ -583,7 +586,8 @@ static void vout_Destructor( vlc_object_t * p_this )
     assert( !p_vout->p_module );
 
     /* */
-    spu_Destroy( p_vout->p_spu );
+    if( p_vout->p_spu )
+        spu_Destroy( p_vout->p_spu );
 
     /* Destroy the locks */
     vlc_cond_destroy( &p_vout->p->change_wait );