diff options
author | al <al@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-07-23 16:10:21 +0000 |
---|---|---|
committer | al <al@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-07-23 16:10:21 +0000 |
commit | 8bad258e0d4b1858c6cf95785f9aae0a2fd7760e (patch) | |
tree | ebde52204e0b8e3686d3e158f171862c14938d26 | |
parent | ea3e5fdf2e2a2991f790e67ab3a67eea9cf45615 (diff) | |
download | mpv-8bad258e0d4b1858c6cf95785f9aae0a2fd7760e.tar.bz2 mpv-8bad258e0d4b1858c6cf95785f9aae0a2fd7760e.tar.xz |
false-use-of-get_path() memleak fixes.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12891 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | input/input.c | 5 | ||||
-rw-r--r-- | mplayer.c | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/input/input.c b/input/input.c index 5287dee7b1..271b8d102f 100644 --- a/input/input.c +++ b/input/input.c @@ -1484,7 +1484,10 @@ mp_input_init(void) { if(!file) return; - if(! mp_input_parse_config(file)) { + if( mp_input_parse_config(file)) { + free(file); // release the buffer created by get_path() + } + else { // Try global conf dir file = MPLAYER_CONFDIR "/input.conf"; if(! mp_input_parse_config(file)) @@ -723,6 +723,7 @@ void update_set_of_subtitles() int main(int argc,char* argv[]){ +char * mem_ptr; static demux_stream_t *d_audio=NULL; static demux_stream_t *d_video=NULL; @@ -904,7 +905,7 @@ int gui_no_filename=0; // check codec.conf if(!codecs_file || !parse_codec_cfg(codecs_file)){ - if(!parse_codec_cfg(get_path("codecs.conf"))){ + if(!parse_codec_cfg(mem_ptr=get_path("codecs.conf"))){ if(!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")){ if(!parse_codec_cfg(NULL)){ mp_msg(MSGT_CPLAYER,MSGL_HINT,MSGTR_CopyCodecsConf); @@ -913,6 +914,7 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){ mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_BuiltinCodecsConf); } } + free( mem_ptr ); // release the buffer created by get_path() } #if 0 @@ -1083,7 +1085,8 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){ if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name); } else { // try default: - vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1); + vo_font=read_font_desc( mem_ptr=get_path("font/font.desc"),font_factor,verbose>1); + free(mem_ptr); // release the buffer created by get_path() if(!vo_font) vo_font=read_font_desc(MPLAYER_DATADIR "/font/font.desc",font_factor,verbose>1); } @@ -1649,11 +1652,13 @@ if(sh_video) { char *psub = get_path( "sub/" ); char **tmp = sub_filenames((psub ? psub : ""), filename); char **tmp2 = tmp; + free(psub); // release the buffer created by get_path() above while (*tmp2) add_subtitles (*tmp2++, sh_video->fps, 0); free(tmp); if (set_of_sub_size == 0) - add_subtitles (get_path("default.sub"), sh_video->fps, 1); + add_subtitles (mem_ptr=get_path("default.sub"), sh_video->fps, 1); + free(mem_ptr); // release the buffer created by get_path() if (set_of_sub_size > 0) add_subtitles (NULL, sh_video->fps, 1); } |