From 74a504a0a88573d3ee2d8a6ab8bbab7aab8fb4fc Mon Sep 17 00:00:00 2001 From: Bui Nguyen Quoc Thanh Date: Tue, 23 Jun 2020 17:13:56 +0700 Subject: 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 --- src/offlinelogstorage/dlt_offline_logstorage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } } -- cgit v1.2.1