From 0f6c8c765aae653e69b0c74f0efde1ae9053d1cf Mon Sep 17 00:00:00 2001 From: al Date: Tue, 3 Aug 2004 12:21:14 +0000 Subject: Corrected my mistake in the last memfix patch. Bug was discovered by Shachar Raindel . The basic patch idea is also from him. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12943 b3059339-0415-0410-9bf9-f77b7e298cf2 --- input/input.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'input') diff --git a/input/input.c b/input/input.c index 271b8d102f..88905189a6 100644 --- a/input/input.c +++ b/input/input.c @@ -1484,15 +1484,24 @@ mp_input_init(void) { if(!file) return; - if( mp_input_parse_config(file)) { - free(file); // release the buffer created by get_path() - } - else { + if( !mp_input_parse_config(file)) { + // free file if it was allocated by get_path(), + // before it gets overwritten + if( file != config_file) + { + free(file); + } // Try global conf dir file = MPLAYER_CONFDIR "/input.conf"; if(! mp_input_parse_config(file)) mp_msg(MSGT_INPUT,MSGL_WARN,"Falling back on default (hardcoded) input config\n"); } + else + { + // free file if it was allocated by get_path() + if( file != config_file) + free(file); + } #ifdef HAVE_JOYSTICK if(use_joystick) { -- cgit v1.2.3