diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c index e65436cae..8b407a9bf 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage.c +++ b/src/offlinelogstorage/dlt_offline_logstorage.c @@ -80,14 +80,16 @@ DLT_STATIC void dlt_logstorage_filter_config_free(DltLogStorageFilterConfig *dat data->ecuid = NULL; } - if (data->log != NULL) - fclose(data->log); + #ifdef DLT_LOGSTORAGE_USE_GZIP if (data->gzlog != NULL) gzclose(data->gzlog); #endif + if (data->log != NULL) + fclose(data->log); + if (data->cache != NULL) { free(data->cache); data->cache = NULL; diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c index fb9c95f2f..005984b58 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c +++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c @@ -371,13 +371,15 @@ int dlt_logstorage_storage_dir_info(DltLogStorageUserConfig *file_config, } char* suffix = NULL; - for (i = 0; i < cnt; i++) { - if (config->gzip_compression) { + + if (config->gzip_compression) { suffix = strdup(".dlt.gz"); } else { suffix = strdup(".dlt"); } + + for (i = 0; i < cnt; i++) { int len = 0; len = strlen(file_name); @@ -501,6 +503,7 @@ DLT_STATIC void dlt_logstorage_open_log_output_file(DltLogStorageFilterConfig *c #ifdef DLT_LOGSTORAGE_USE_GZIP dlt_vlog(LOG_DEBUG, "%s: Opening GZIP log file\n", __func__); config->gzlog = gzdopen(config->fd, mode); + config->log = file; #endif } else { dlt_vlog(LOG_DEBUG, "%s: Opening log file\n", __func__);