[vlc-commits] [Git][videolan/vlc][master] 2 commits: decoder: change DeleteDecoder arguments

Thomas Guillem (@tguillem) gitlab at videolan.org
Wed Jan 5 16:52:59 UTC 2022



Thomas Guillem pushed to branch master at VideoLAN / VLC


Commits:
905f468e by Thomas Guillem at 2022-01-05T16:23:03+00:00
decoder: change DeleteDecoder arguments

Use the category from the i_cat argument instead of dec->fmt_in.i_cat

Refs #26271

- - - - -
2c65888b by Thomas Guillem at 2022-01-05T16:23:03+00:00
decoder: fix possible output leak when the codec is unsupported

dec->fmt_in.i_cat might be UNKNOWN_ES when the codec is not supported
leading to an output leak from DeleteDecoder() since the category
specific code is not reached.

Fixes #26271

- - - - -


1 changed file:

- src/input/decoder.c


Changes:

=====================================
src/input/decoder.c
=====================================
@@ -1961,13 +1961,12 @@ CreateDecoder( vlc_object_t *p_parent, const es_format_t *fmt,
  * \param p_dec the decoder object
  * \return nothing
  */
-static void DeleteDecoder( vlc_input_decoder_t *p_owner )
+static void DeleteDecoder( vlc_input_decoder_t *p_owner, enum es_format_category_e i_cat )
 {
     decoder_t *p_dec = &p_owner->dec;
     msg_Dbg( p_dec, "killing decoder fourcc `%4.4s'",
              (char*)&p_dec->fmt_in.i_codec );
 
-    const enum es_format_category_e i_cat =p_dec->fmt_in.i_cat;
     decoder_Clean( p_dec );
     if ( p_owner->out_pool )
     {
@@ -2093,7 +2092,8 @@ decoder_New( vlc_object_t *p_parent, const es_format_t *fmt, const char *psz_id,
     {
         DecoderUnsupportedCodec( p_dec, fmt, !p_sout );
 
-        DeleteDecoder( p_owner );
+        /* Don't use dec->fmt_in.i_cat since it may not be initialized here. */
+        DeleteDecoder( p_owner, fmt->i_cat );
         return NULL;
     }
 
@@ -2125,7 +2125,7 @@ decoder_New( vlc_object_t *p_parent, const es_format_t *fmt, const char *psz_id,
     if( vlc_clone( &p_owner->thread, DecoderThread, p_owner, i_priority ) )
     {
         msg_Err( p_dec, "cannot spawn decoder thread" );
-        DeleteDecoder( p_owner );
+        DeleteDecoder( p_owner, p_dec->fmt_in.i_cat );
         return NULL;
     }
 
@@ -2227,7 +2227,7 @@ void vlc_input_decoder_Delete( vlc_input_decoder_t *p_owner )
     }
 
     /* Delete decoder */
-    DeleteDecoder( p_owner );
+    DeleteDecoder( p_owner, p_dec->fmt_in.i_cat );
 }
 
 /**



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bce57ed795b288901d7b6f50d46fe74c667e6792...2c65888b0f1697031e0caf79818a55149fb756b4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bce57ed795b288901d7b6f50d46fe74c667e6792...2c65888b0f1697031e0caf79818a55149fb756b4
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list