summaryrefslogtreecommitdiff
path: root/src/system/dlt-system.h
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.h
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.h')
-rw-r--r--src/system/dlt-system.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/system/dlt-system.h b/src/system/dlt-system.h
index 9be1cf4..bbd09fd 100644
--- a/src/system/dlt-system.h
+++ b/src/system/dlt-system.h
@@ -115,14 +115,14 @@ typedef struct {
/* Configuration syslog options */
typedef struct {
int Enable;
- char *ContextId;
+ char ContextId[DLT_ID_SIZE];
int Port;
} SyslogOptions;
/* Configuration journal options */
typedef struct {
int Enable;
- char *ContextId;
+ char ContextId[DLT_ID_SIZE];
int CurrentBoot;
int Follow;
int MapLogLevels;
@@ -131,7 +131,7 @@ typedef struct {
typedef struct {
int Enable;
- char *ContextId;
+ char ContextId[DLT_ID_SIZE];
int TimeStartup;
int TimeoutBetweenLogs;
char *TempDir;
@@ -153,7 +153,7 @@ typedef struct {
/* Variable number of files to transfer */
int Count;
- char *ContextId[DLT_SYSTEM_LOG_FILE_MAX];
+ char ContextId[DLT_SYSTEM_LOG_FILE_MAX][DLT_ID_SIZE];
char *Filename[DLT_SYSTEM_LOG_FILE_MAX];
int Mode[DLT_SYSTEM_LOG_FILE_MAX];
int TimeDelay[DLT_SYSTEM_LOG_FILE_MAX];
@@ -161,7 +161,7 @@ typedef struct {
typedef struct {
int Enable;
- char *ContextId;
+ char ContextId[DLT_ID_SIZE];
/* Variable number of processes */
int Count;
@@ -172,7 +172,7 @@ typedef struct {
} LogProcessOptions;
typedef struct {
- char *ApplicationId;
+ char ApplicationId[DLT_ID_SIZE];
ShellOptions Shell;
SyslogOptions Syslog;
JournalOptions Journal;
@@ -188,6 +188,7 @@ typedef struct {
/* In dlt-system-options.c */
int read_command_line(DltSystemCliOptions *options, int argc, char *argv[]);
int read_configuration_file(DltSystemConfiguration *config, char *file_name);
+void cleanup_config(DltSystemConfiguration *config, DltSystemCliOptions *options);
/* For dlt-process-handling.c */
int daemonize();