[vlc-commits] avcodec: use var_InheritString()

Rémi Denis-Courmont git at videolan.org
Mon Jun 19 19:58:33 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 19 18:17:25 2017 +0300| [c2c55f32f3d73b28e3ce02b34cb571c5e4fd3df5] | committer: Rémi Denis-Courmont

avcodec: use var_InheritString()

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

 modules/codec/avcodec/avcodec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 11f9f38c1f..e50957d139 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -267,8 +267,8 @@ static int OpenDecoder( vlc_object_t *p_this )
     vlc_init_avcodec(p_this);
 
     /* *** ask ffmpeg for a decoder *** */
-    char *psz_decoder = var_CreateGetString( p_this, "avcodec-codec" );
-    if( psz_decoder && *psz_decoder )
+    char *psz_decoder = var_InheritString( p_this, "avcodec-codec" );
+    if( psz_decoder != NULL )
     {
         p_codec = avcodec_find_decoder_by_name( psz_decoder );
         if( !p_codec )
@@ -279,8 +279,8 @@ static int OpenDecoder( vlc_object_t *p_this )
                     psz_decoder, (char*)&p_dec->fmt_in.i_codec );
             p_codec = NULL;
         }
+        free( psz_decoder );
     }
-    free( psz_decoder );
     if( !p_codec )
         p_codec = avcodec_find_decoder( i_codec_id );
     if( !p_codec )



More information about the vlc-commits mailing list