mirror of https://github.com/PCSX2/pcsx2.git
onepad: avoid potential resource leak
This commit is contained in:
parent
f4f08b9c99
commit
b082147c4d
|
@ -171,15 +171,15 @@ void LoadConfig()
|
|||
}
|
||||
|
||||
u32 value;
|
||||
if (fscanf(f, "log = %d\n", &value) == 0) return;
|
||||
if (fscanf(f, "log = %d\n", &value) == 0) goto error;
|
||||
conf->log = value;
|
||||
if (fscanf(f, "options = %d\n", &value) == 0) return;
|
||||
if (fscanf(f, "options = %d\n", &value) == 0) goto error;
|
||||
conf->options = value;
|
||||
if (fscanf(f, "mouse_sensibility = %d\n", &value) == 0) return;
|
||||
if (fscanf(f, "mouse_sensibility = %d\n", &value) == 0) goto error;
|
||||
conf->sensibility = value;
|
||||
if (fscanf(f, "joy_pad_map = %d\n", &value) == 0) return;
|
||||
if (fscanf(f, "joy_pad_map = %d\n", &value) == 0) goto error;
|
||||
conf->joyid_map = value;
|
||||
if (fscanf(f, "ff_intensity = %d\n", &value) == 0) return;
|
||||
if (fscanf(f, "ff_intensity = %d\n", &value) == 0) goto error;
|
||||
conf->ff_intensity = value;
|
||||
|
||||
for (int pad = 0; pad < 2; pad++)
|
||||
|
@ -203,7 +203,9 @@ void LoadConfig()
|
|||
if(pad == 0) have_user_setting = true;
|
||||
}
|
||||
|
||||
if (!have_user_setting) DefaultKeyboardValues();
|
||||
|
||||
error:
|
||||
fclose(f);
|
||||
|
||||
if (!have_user_setting) DefaultKeyboardValues();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue