envy24control: fix crash when using system profiles file

envy24control crashed if you tried to start it with -f
/etc/envy24control/profiles.conf.

Closes: https://github.com/alsa-project/alsa-tools/pull/32
Signed-off-by: Andreas Persson <andreasp56@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Andreas Persson 2025-03-29 08:28:32 +01:00 committed by Jaroslav Kysela
parent dcf1b94682
commit 037ae73ab3

View file

@ -78,7 +78,9 @@ int which_cfgfile(char ** const cfgfile)
(inputFile = fopen(SYS_PROFILERC, "r")) == NULL) { (inputFile = fopen(SYS_PROFILERC, "r")) == NULL) {
res = -ENOENT; res = -ENOENT;
} else { } else {
fclose(inputFile); if (inputFile != NULL) {
fclose(inputFile);
}
*cfgfile = SYS_PROFILERC; *cfgfile = SYS_PROFILERC;
res = EXIT_SUCCESS; res = EXIT_SUCCESS;
} }