comparison input/input.c @ 12942:abe577c2b12e

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.
author al
date Tue, 03 Aug 2004 12:21:14 +0000
parents 9a45f43bf9a0
children b9171604a4ac
comparison
equal deleted inserted replaced
12941:876bcf984097 12942:abe577c2b12e
1482 1482
1483 file = config_file[0] != '/' ? get_path(config_file) : config_file; 1483 file = config_file[0] != '/' ? get_path(config_file) : config_file;
1484 if(!file) 1484 if(!file)
1485 return; 1485 return;
1486 1486
1487 if( mp_input_parse_config(file)) { 1487 if( !mp_input_parse_config(file)) {
1488 free(file); // release the buffer created by get_path() 1488 // free file if it was allocated by get_path(),
1489 } 1489 // before it gets overwritten
1490 else { 1490 if( file != config_file)
1491 {
1492 free(file);
1493 }
1491 // Try global conf dir 1494 // Try global conf dir
1492 file = MPLAYER_CONFDIR "/input.conf"; 1495 file = MPLAYER_CONFDIR "/input.conf";
1493 if(! mp_input_parse_config(file)) 1496 if(! mp_input_parse_config(file))
1494 mp_msg(MSGT_INPUT,MSGL_WARN,"Falling back on default (hardcoded) input config\n"); 1497 mp_msg(MSGT_INPUT,MSGL_WARN,"Falling back on default (hardcoded) input config\n");
1498 }
1499 else
1500 {
1501 // free file if it was allocated by get_path()
1502 if( file != config_file)
1503 free(file);
1495 } 1504 }
1496 1505
1497 #ifdef HAVE_JOYSTICK 1506 #ifdef HAVE_JOYSTICK
1498 if(use_joystick) { 1507 if(use_joystick) {
1499 int fd = mp_input_joystick_init(js_dev); 1508 int fd = mp_input_joystick_init(js_dev);