summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
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) {