summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authoral <al@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-08-03 12:21:14 +0000
committeral <al@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-08-03 12:21:14 +0000
commit0f6c8c765aae653e69b0c74f0efde1ae9053d1cf (patch)
tree28a7181e1a83b5f7aa002fd5aba7d1931d8d9dd8 /input
parent50570ae8203915dc996b39e7d1ba05ad45e7cac7 (diff)
downloadmpv-0f6c8c765aae653e69b0c74f0efde1ae9053d1cf.tar.bz2
mpv-0f6c8c765aae653e69b0c74f0efde1ae9053d1cf.tar.xz
Corrected my mistake in the last memfix patch.
Bug was discovered by Shachar Raindel <shacharr@gmail.com>. The basic patch idea is also from him. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12943 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'input')
-rw-r--r--input/input.c17
1 files changed, 13 insertions, 4 deletions
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) {