[MPlayer-dev-eng] [PATCH] Libass BOM fix

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Oct 27 16:45:59 CEST 2007


Hello,
On Sat, Oct 27, 2007 at 10:01:29PM +0800, Ulion wrote:
> A memory leak bug found in sub_recode, my fix is here:

Better don't send patches for new issues as replies.
Also if you send them inline take care your mailer doesn't wrap lines.
And attached patch seems simpler (and would allow to remove the later
#ifdef HAVE_ENCA).
Note that it is untested though.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libass/ass.c
===================================================================
--- libass/ass.c	(revision 24859)
+++ libass/ass.c	(working copy)
@@ -804,7 +804,7 @@
 	assert(codepage);
 
 	{
-		char* cp_tmp = codepage ? strdup(codepage) : 0;
+		char* cp_tmp = NULL;
 #ifdef HAVE_ENCA
 		char enca_lang[3], enca_fallback[100];
 		if (sscanf(codepage, "enca:%2s:%99s", enca_lang, enca_fallback) == 2
@@ -812,7 +812,7 @@
 			cp_tmp = guess_buffer_cp((unsigned char*)data, size, enca_lang, enca_fallback);
 		}
 #endif
-		if ((icdsc = iconv_open (tocp, cp_tmp)) != (iconv_t)(-1)){
+		if ((icdsc = iconv_open (tocp, cp_tmp ? cp_tmp : codepage)) != (iconv_t)(-1)){
 			mp_msg(MSGT_ASS,MSGL_V,"LIBSUB: opened iconv descriptor.\n");
 		} else
 			mp_msg(MSGT_ASS,MSGL_ERR,MSGTR_LIBASS_ErrorOpeningIconvDescriptor);


More information about the MPlayer-dev-eng mailing list