summaryrefslogtreecommitdiff
path: root/src/system/dlt-system.c
diff options
context:
space:
mode:
authordbiastoch <dbiastoch@de.adit-jv.com>2021-06-29 17:01:11 +0200
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2021-10-05 11:19:26 +0900
commit0d36bba6f1b2cb531df6d18ecc6d3c61364ff469 (patch)
treedf33a04df0991c20b377d6048d8b780498fa4fd0 /src/system/dlt-system.c
parent11ef793a0b39d7a3c851af90dd2ddb0ba3028458 (diff)
downloadDLT-daemon-0d36bba6f1b2cb531df6d18ecc6d3c61364ff469.tar.gz
dlt-system: Fix memory leak in dlt-system config
In read_configuration_file() inside dlt-system-options.c memory is allocated for saving the parsed options into config struct. This memory is not freed again. There are two major changes for resolving this issue: 1) Add a cleanup function inside dlt-system-options.c to free allocated memory 2) Replace all AppID and ContextID char pointer through a char array with the lenght of DLT_ID_SIZE. Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
Diffstat (limited to 'src/system/dlt-system.c')
-rw-r--r--src/system/dlt-system.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/system/dlt-system.c b/src/system/dlt-system.c
index 92ea466..4f3959e 100644
--- a/src/system/dlt-system.c
+++ b/src/system/dlt-system.c
@@ -49,6 +49,7 @@
#include <string.h>
#include <errno.h>
#include <signal.h>
+#include <stdlib.h>
#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE) || defined(DLT_SYSTEMD_ENABLE)
# include "sd-daemon.h"
@@ -114,9 +115,10 @@ int main(int argc, char *argv[])
DLT_LOG(dltsystem, DLT_LOG_DEBUG, DLT_STRING("Initializing all processes and starting poll for events."));
-
start_dlt_system_processes(&config);
- return 0;
+
+ cleanup_config(&config, &options);
+ exit(0);
}