summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>2020-06-23 17:13:56 +0700
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2020-07-06 10:04:07 +0900
commit74a504a0a88573d3ee2d8a6ab8bbab7aab8fb4fc (patch)
treed688eb80c689b0fcb9e95a214a8437a72cfddb4a
parent2620f970eb4d29cf116f8b7b6ef60f8ead17e9ea (diff)
downloadDLT-daemon-74a504a0a88573d3ee2d8a6ab8bbab7aab8fb4fc.tar.gz
logstorage: Issue with more than 2 filters
While allocating new memory for record of newest file name, it is mistake to not point to the last element of list. So the total size of list was only 2 at all. Solution: must reserve the last pointer in order the newest file list is updated correctly. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c
index 5eaf107..124b7a4 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage.c
@@ -735,6 +735,7 @@ DLT_STATIC int dlt_logstorage_prepare_table(DltLogStorage *handle,
int found = 0;
char *keys = NULL;
DltNewestFileName *tmp = NULL;
+ DltNewestFileName *prev_tmp = NULL;
DltNewestFileName *new_tmp = NULL;
if ((handle == NULL) || (data == NULL)) {
@@ -775,6 +776,7 @@ DLT_STATIC int dlt_logstorage_prepare_table(DltLogStorage *handle,
break;
}
else {
+ prev_tmp = tmp;
tmp = tmp->next;
}
}
@@ -798,7 +800,7 @@ DLT_STATIC int dlt_logstorage_prepare_table(DltLogStorage *handle,
if (handle->newest_file_list == NULL)
handle->newest_file_list = new_tmp;
else
- handle->newest_file_list->next = new_tmp;
+ prev_tmp->next = new_tmp;
}
}