From 8dfd0938723d695d7cf560d74d0a03b72b6b20b4 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. Signed-off-by: Andreas Persson --- 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; }