[vlc-commits] input: fix iconv handle leak

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


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

input: fix iconv handle leak

This occurred if a UTF-16 text stream was rewound to the beginning and
read again.

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

 src/input/stream.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/input/stream.c b/src/input/stream.c
index adda2ac18d..affc7b2c0d 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -196,6 +196,12 @@ char *vlc_stream_ReadLine( stream_t *s )
         {
             const char *psz_encoding = NULL;
 
+            if( unlikely(priv->text.conv != (vlc_iconv_t)-1) )
+            {   /* seek back to beginning? reset */
+                vlc_iconv_close( priv->text.conv );
+                priv->text.conv = (vlc_iconv_t)-1;
+            }
+
             if( !memcmp( p_data, "\xFF\xFE", 2 ) )
             {
                 psz_encoding = "UTF-16LE";



More information about the vlc-commits mailing list