From: Andreas Persson Date: Sat, 29 Mar 2025 07:28:32 +0000 (+0100) Subject: envy24control: fix crash when using system profiles file X-Git-Tag: v1.2.14~7 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=037ae73ab346511cf63e446865ea618e0d98bb54;p=alsa-tools.git 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 Signed-off-by: Jaroslav Kysela --- diff --git a/envy24control/profiles.c b/envy24control/profiles.c index 17a418c..6dbe7d1 100644 --- a/envy24control/profiles.c +++ b/envy24control/profiles.c @@ -78,7 +78,9 @@ int which_cfgfile(char ** const cfgfile) (inputFile = fopen(SYS_PROFILERC, "r")) == NULL) { res = -ENOENT; } else { - fclose(inputFile); + if (inputFile != NULL) { + fclose(inputFile); + } *cfgfile = SYS_PROFILERC; res = EXIT_SUCCESS; }