[MPlayer-dev-eng] [PATCH] Fix memory leak in mencoder.c
Thierry Foucu
tfoucu at gmail.com
Wed May 5 18:28:31 CEST 2010
Hi
$subject
the return of get_path("codecs.conf") is never freed
Index: mencoder.c
===================================================================
--- mencoder.c (revision 31137)
+++ mencoder.c (working copy)
@@ -610,13 +610,17 @@
// check codec.conf
if(!codecs_file || !parse_codec_cfg(codecs_file)){
- if(!parse_codec_cfg(get_path("codecs.conf"))){
- if(!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")){
- if(!parse_codec_cfg(NULL)){
- mencoder_exit(1,NULL);
+ const char * conf_file = get_path("codecs.conf");
+ if (conf_file){
+ if(!parse_codec_cfg(get_path("codecs.conf"))){
+ if(!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")){
+ if(!parse_codec_cfg(NULL)){
+ mencoder_exit(1,NULL);
+ }
+ mp_msg(MSGT_MENCODER,MSGL_V,MSGTR_BuiltinCodecsConf);
}
- mp_msg(MSGT_MENCODER,MSGL_V,MSGTR_BuiltinCodecsConf);
}
+ free(conf_file);
}
}
-------------- next part --------------
Index: mencoder.c
===================================================================
--- mencoder.c (revision 31137)
+++ mencoder.c (working copy)
@@ -610,13 +610,17 @@
// check codec.conf
if(!codecs_file || !parse_codec_cfg(codecs_file)){
- if(!parse_codec_cfg(get_path("codecs.conf"))){
- if(!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")){
- if(!parse_codec_cfg(NULL)){
- mencoder_exit(1,NULL);
+ const char * conf_file = get_path("codecs.conf");
+ if (conf_file){
+ if(!parse_codec_cfg(get_path("codecs.conf"))){
+ if(!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")){
+ if(!parse_codec_cfg(NULL)){
+ mencoder_exit(1,NULL);
+ }
+ mp_msg(MSGT_MENCODER,MSGL_V,MSGTR_BuiltinCodecsConf);
}
- mp_msg(MSGT_MENCODER,MSGL_V,MSGTR_BuiltinCodecsConf);
}
+ free(conf_file);
}
}
More information about the MPlayer-dev-eng
mailing list