From 35f599d4511ff3c48ac1e3d6943503fe4c78a80b Mon Sep 17 00:00:00 2001 From: vladimir-aurora Date: Thu, 9 May 2024 12:47:03 +0200 Subject: [PATCH] Close config file handle on error. (#613) --- src/daemon/dlt-daemon.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index 9a1bb842b..15ac8630a 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -573,20 +573,26 @@ int option_file_parser(DltDaemonLocal *daemon_local) else if (strcmp(token, "RingbufferMinSize") == 0) { if (dlt_daemon_check_numeric_setting(token, - value, &(daemon_local->RingbufferMinSize)) < 0) + value, &(daemon_local->RingbufferMinSize)) < 0) { + fclose (pFile); return -1; + } } else if (strcmp(token, "RingbufferMaxSize") == 0) { if (dlt_daemon_check_numeric_setting(token, - value, &(daemon_local->RingbufferMaxSize)) < 0) + value, &(daemon_local->RingbufferMaxSize)) < 0) { + fclose (pFile); return -1; + } } else if (strcmp(token, "RingbufferStepSize") == 0) { if (dlt_daemon_check_numeric_setting(token, - value, &(daemon_local->RingbufferStepSize)) < 0) + value, &(daemon_local->RingbufferStepSize)) < 0) { + fclose (pFile); return -1; + } } else if (strcmp(token, "SharedMemorySize") == 0) { @@ -755,8 +761,10 @@ int option_file_parser(DltDaemonLocal *daemon_local) else if (strcmp(token, "DaemonFIFOSize") == 0) { if (dlt_daemon_check_numeric_setting(token, - value, &(daemon_local->daemonFifoSize)) < 0) + value, &(daemon_local->daemonFifoSize)) < 0) { + fclose (pFile); return -1; + } #ifndef __linux__ printf("Option DaemonFIFOSize is set but only supported on Linux. Ignored.\n"); #endif