From 037ae73ab346511cf63e446865ea618e0d98bb54 Mon Sep 17 00:00:00 2001 From: Andreas Persson Date: Sat, 29 Mar 2025 08:28:32 +0100 Subject: [PATCH] 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 --- envy24control/profiles.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.47.1