[MPlayer-dev-eng] [PATCH] resource leak on failed subtitle load
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Mar 8 11:38:08 CET 2006
Hi,
the currently is a (very unlikely) resource leak, namely when subtitle
loading fails because there already are too many (set_of_sub_size >=
MAX_SUBTITLE_FILES).
The attached patch fixes that and also makes MPlayer print an error
message in this case, too (though it might be suboptimal that it is the
same one no matter for what reason loading failed).
Okay to apply? If no objections I will apply tomorrow or so.
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.912
diff -u -r1.912 mplayer.c
--- mplayer.c 5 Mar 2006 08:55:08 -0000 1.912
+++ mplayer.c 8 Mar 2006 10:34:49 -0000
@@ -794,9 +797,13 @@
}
subd = sub_read_file(filename, fps);
- if(!subd && !silent)
+ if(!subd || set_of_sub_size >= MAX_SUBTITLE_FILES) {
+ if (!silent)
mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_CantLoadSub, filename);
- if (subd == NULL || set_of_sub_size >= MAX_SUBTITLE_FILES) return;
+ if (subd)
+ free(subd);
+ return;
+ }
set_of_subtitles[set_of_sub_size] = subd;
if (identify)
{
More information about the MPlayer-dev-eng
mailing list