]> git.alsa-project.org Git - alsa-tools.git/commitdiff
envy24control: fix crash when using system profiles file
authorAndreas Persson <andreasp56@outlook.com>
Sat, 29 Mar 2025 07:28:32 +0000 (08:28 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 8 Apr 2025 13:23:11 +0000 (15:23 +0200)
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>
envy24control/profiles.c

index 17a418cc8a0069fdf28fe79c39488789bd916f51..6dbe7d17b5d6666bec6aac0528947dc52bb5be49 100644 (file)
@@ -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;
                }