[vlc-devel] [PATCH 1/8] stream_ReadLine: don't gratuitiously close iconv handle on unrelated error

Pierre Ynard linkfanel at yahoo.fr
Wed Oct 21 05:20:37 CEST 2020

The only errors after which this was called were memory allocation
errors, lines too long, or failing to open the handle itself, so
obviously there is no reason to want to close it there; it already gets
closed in the proper place when the stream is destroyed.

Even worse, it left the handle missing if vlc_stream_ReadLine() was
called again, and would result in text conversion constantly failing and
no output getting returned anymore, rendering the rest of the stream
unusable through this API and precluding any error recovery.

diff --git a/src/input/stream.c b/src/input/stream.c
index 90651de..65e1e24 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -370,13 +370,6 @@ char *vlc_stream_ReadLine( stream_t *s )
     /* We failed to read any data, probably EOF */
     free( p_line );
-    /* */
-    if( priv->text.conv != (vlc_iconv_t)(-1) )
-    {
-        vlc_iconv_close( priv->text.conv );
-        priv->text.conv = (vlc_iconv_t)(-1);
-    }
     return NULL;
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."

More information about the vlc-devel mailing list