summaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
authorlti9hc <114125133+lti9hc@users.noreply.github.com>2022-10-26 15:11:24 +0700
committerGitHub <noreply@github.com>2022-10-26 10:11:24 +0200
commit948ed9928d933bbbfbb704ab0cc2296cb4333055 (patch)
treed18c533ba25de25a11e6ad2779305d14d19bdfeb /src/daemon
parent0f969a93770b2261b6d18b9296263f0deaf134bd (diff)
downloadDLT-daemon-948ed9928d933bbbfbb704ab0cc2296cb4333055.tar.gz
Fix for Resource and Memory Leak (#418)
dlt_daemon_client.c Adding NULL check for tok dlt_daemon_offline_logstorage.c : Adding NULL check for application dlt_user.c : Fix for Memory Leak dlt-daemon.c : Fix for Resource Leak dlt_config_file_parser.c : Add termination character at the end of string dlt_offline_trace.c : Fix for Resource Leak Signed-off-by: Mvaradaraj2 manoj.varadaraj2@harman.com Co-authored-by: Le Tin <tin.le@vn.bosch.com>
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/dlt-daemon.c4
-rw-r--r--src/daemon/dlt_daemon_client.c2
-rw-r--r--src/daemon/dlt_daemon_offline_logstorage.c9
3 files changed, 11 insertions, 4 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 2c9ff6a..c8a8506 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -1009,7 +1009,7 @@ int main(int argc, char *argv[])
dlt_log(LOG_ERR, "Could not load runtime config\n");
return -1;
}
-
+
/*
* Load dlt-runtime.cfg if available.
* This must be loaded before offline setup
@@ -2157,6 +2157,8 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon,
if (dlt_daemon_send_ringbuffer_to_client(daemon, daemon_local, verbose) == -1) {
dlt_log(LOG_WARNING, "Can't send contents of ringbuffer to clients\n");
+ close(in_sock);
+ in_sock = -1;
return -1;
}
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index 82e2965..9ebbd23 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -1085,7 +1085,7 @@ void dlt_daemon_control_get_log_info(int sock,
daemon->ecuid,
verbose);
- if (application) {
+ if ((user_list->applications) && (application)) {
/* Calculate start offset within contexts[] */
offset_base = 0;
diff --git a/src/daemon/dlt_daemon_offline_logstorage.c b/src/daemon/dlt_daemon_offline_logstorage.c
index 5d21a76..c796d06 100644
--- a/src/daemon/dlt_daemon_offline_logstorage.c
+++ b/src/daemon/dlt_daemon_offline_logstorage.c
@@ -233,9 +233,14 @@ DLT_STATIC DltReturnValue dlt_logstorage_split_multi(char *key,
else {
strncpy(ecuid, tok, DLT_ID_SIZE);
tok = strtok(NULL, ":");
- strncpy(apid, tok, DLT_ID_SIZE);
+
+ if (tok != NULL)
+ strncpy(apid, tok, DLT_ID_SIZE);
+
tok = strtok(NULL, ":");
- strncpy(ctid, tok, DLT_ID_SIZE);
+
+ if (tok != NULL)
+ strncpy(ctid, tok, DLT_ID_SIZE);
}
return DLT_RETURN_OK;