[MPlayer-dev-eng] [PATCH] Libass BOM fix
Ulion
ulion2002 at gmail.com
Sat Oct 27 16:01:29 CEST 2007
Hello,
A memory leak bug found in sub_recode, my fix is here:
Index: libass/ass.c
===================================================================
--- libass/ass.c (revision 24859)
+++ libass/ass.c (working copy)
@@ -804,12 +804,14 @@
assert(codepage);
{
- char* cp_tmp = codepage ? strdup(codepage) : 0;
+ char* cp_tmp = codepage;
#ifdef HAVE_ENCA
+ int free_cp_tmp = 0;
char enca_lang[3], enca_fallback[100];
if (sscanf(codepage, "enca:%2s:%99s", enca_lang,
enca_fallback) == 2
|| sscanf(codepage, "ENCA:%2s:%99s",
enca_lang, enca_fallback) == 2) {
cp_tmp = guess_buffer_cp((unsigned char*)data,
size, enca_lang, enca_fallback);
+ free_cp_tmp = 1;
}
#endif
if ((icdsc = iconv_open (tocp, cp_tmp)) != (iconv_t)(-1)){
@@ -817,7 +819,7 @@
} else
mp_msg(MSGT_ASS,MSGL_ERR,MSGTR_LIBASS_ErrorOpeningIconvDescriptor);
#ifdef HAVE_ENCA
- if (cp_tmp) free(cp_tmp);
+ if (free_cp_tmp) free(cp_tmp);
#endif
}
--
Ulion
More information about the MPlayer-dev-eng
mailing list