[vlc-commits] input: handle error in stream_ReadLine()

Rémi Denis-Courmont git at videolan.org
Wed Jun 21 20:12:57 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 21 21:08:56 2017 +0300| [a672ea060efbb5898e1d80327f5909a43e8b57d8] | committer: Rémi Denis-Courmont

input: handle error in stream_ReadLine()

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

 src/input/stream.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index ac4073dc06..adda2ac18d 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -210,10 +210,13 @@ char *vlc_stream_ReadLine( stream_t *s )
             if( psz_encoding != NULL )
             {
                 msg_Dbg( s, "UTF-16 BOM detected" );
-                priv->text.char_width = 2;
                 priv->text.conv = vlc_iconv_open( "UTF-8", psz_encoding );
-                if( priv->text.conv == (vlc_iconv_t)-1 )
+                if( unlikely(priv->text.conv == (vlc_iconv_t)-1) )
+                {
                     msg_Err( s, "iconv_open failed" );
+                    goto error;
+                }
+                priv->text.char_width = 2;
             }
         }
 



More information about the vlc-commits mailing list