summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Kloska <sebastian.kloska@snafu.de>2020-02-19 12:45:50 +0100
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2020-02-20 08:26:10 +0900
commit624ea834dcfd727abee1b715c90e9185f8bd617a (patch)
treee271addce0dfef5825cb9b4829439043c917b98e
parentb43778c961d20c20038212f590107911429dc46d (diff)
downloadDLT-daemon-624ea834dcfd727abee1b715c90e9185f8bd617a.tar.gz
FIX: Check validity of `file` pointer before usage.
Check for file == null before accessing the pointer for a debug message Signed-off-by: Sebastian Kloska <sebastian.kloska@snafu.de>
-rw-r--r--src/shared/dlt_common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index a36139c..c577249 100644
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -1415,13 +1415,13 @@ DltReturnValue dlt_file_read(DltFile *file, int verbose)
long *ptr;
int found = DLT_RETURN_OK;
+ if (file == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
if (verbose) {
dlt_vlog(LOG_DEBUG, "%s: Message %d:\n", __func__, file->counter_total);
}
- if (file == NULL)
- return DLT_RETURN_WRONG_PARAMETER;
-
/* allocate new memory for index if number of messages exceeds a multiple of DLT_COMMON_INDEX_ALLOC (e.g.: 1000) */
if (file->counter % DLT_COMMON_INDEX_ALLOC == 0) {
ptr = (long *)malloc(((file->counter / DLT_COMMON_INDEX_ALLOC) + 1) * DLT_COMMON_INDEX_ALLOC * sizeof(long));