[MPlayer-cvslog] r37828 - in trunk: mencoder.c mp_msg.c mp_msg.h mplayer.c

reimar subversion at mplayerhq.hu
Wed Mar 2 23:08:46 CET 2016


Author: reimar
Date: Wed Mar  2 23:08:46 2016
New Revision: 37828

Log:
mp_msg: free iconv contexts at exit.

Modified:
   trunk/mencoder.c
   trunk/mp_msg.c
   trunk/mp_msg.h
   trunk/mplayer.c

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	Wed Mar  2 23:08:45 2016	(r37827)
+++ trunk/mencoder.c	Wed Mar  2 23:08:46 2016	(r37828)
@@ -1736,6 +1736,7 @@ if(stream) free_stream(stream); // kill
 if(mux_v) free(mux_v->buffer);
 if(mux_a) free(mux_a->buffer);
 common_uninit();
+mp_msg_uninit();
 
 return interrupted;
 }

Modified: trunk/mp_msg.c
==============================================================================
--- trunk/mp_msg.c	Wed Mar  2 23:08:45 2016	(r37827)
+++ trunk/mp_msg.c	Wed Mar  2 23:08:46 2016	(r37828)
@@ -44,6 +44,7 @@ int mp_msg_module = 0;
 char *mp_msg_charset = NULL;
 static char *old_charset = NULL;
 static iconv_t msgiconv;
+static iconv_t inv_msgiconv = (iconv_t)(-1);
 #endif
 
 const char* filename_recode(const char* filename)
@@ -51,7 +52,6 @@ const char* filename_recode(const char*
 #if !defined(CONFIG_ICONV) || !defined(MSG_CHARSET)
     return filename;
 #else
-    static iconv_t inv_msgiconv = (iconv_t)(-1);
     static char recoded_filename[MSGSIZE_MAX];
     size_t filename_len, max_path;
     char* precoded;
@@ -91,6 +91,17 @@ void mp_msg_init(void){
 #endif
 }
 
+void mp_msg_uninit(void)
+{
+#ifdef CONFIG_ICONV
+    if (old_charset) {
+        free(old_charset);
+        iconv_close(msgiconv);
+    }
+    if (inv_msgiconv != (iconv_t)(-1)) iconv_close(inv_msgiconv);
+#endif
+}
+
 int mp_msg_test(int mod, int lev)
 {
     return lev <= (mp_msg_levels[mod] == -2 ? mp_msg_level_all + verbose : mp_msg_levels[mod]);

Modified: trunk/mp_msg.h
==============================================================================
--- trunk/mp_msg.h	Wed Mar  2 23:08:45 2016	(r37827)
+++ trunk/mp_msg.h	Wed Mar  2 23:08:46 2016	(r37828)
@@ -138,6 +138,7 @@ extern int mp_msg_level_all;
 
 
 void mp_msg_init(void);
+void mp_msg_uninit(void);
 int mp_msg_test(int mod, int lev);
 
 #include "config.h"

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Wed Mar  2 23:08:45 2016	(r37827)
+++ trunk/mplayer.c	Wed Mar  2 23:08:46 2016	(r37828)
@@ -755,6 +755,8 @@ void exit_player_with_rc(enum exit_reaso
         m_config_free(mconfig);
     mconfig = NULL;
 
+    mp_msg_uninit();
+
     exit(rc);
 }
 


More information about the MPlayer-cvslog mailing list