Skip to content

Commit

Permalink
dlt-user: fix address sanitzer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmohr committed Jul 14, 2024
1 parent 358ab08 commit a5ea5f1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/dlt_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ enum InitState {

static DltUser dlt_user;
static _Atomic enum InitState dlt_user_init_state = INIT_UNITIALIZED;
#define DLT_USER_INITALIZED (dlt_user_init_state == INIT_DONE)

static _Atomic int dlt_user_freeing = 0;
static bool dlt_user_file_reach_max = false;

#define DLT_USER_INITALIZED ((dlt_user_init_state == INIT_DONE) && !dlt_user_freeing)

#ifdef DLT_LIB_USE_FIFO_IPC
static char dlt_user_dir[DLT_PATH_MAX];
static char dlt_daemon_fifo[DLT_PATH_MAX];
Expand Down Expand Up @@ -457,7 +458,9 @@ DltReturnValue dlt_init(void)
{
/* process is exiting. Do not allocate new resources. */
if (dlt_user_freeing != 0) {
#ifndef DLT_UNIT_TESTS
dlt_vlog(LOG_INFO, "%s logging disabled, process is exiting\n", __func__);
#endif
/* return negative value, to stop the current log */
return DLT_RETURN_LOGGING_DISABLED;
}
Expand Down Expand Up @@ -4887,6 +4890,10 @@ void dlt_user_log_reattach_to_daemon(void)
DltContext handle;
DltContextData log_new;

if (!DLT_USER_INITALIZED) {
return;
}

if (dlt_user.dlt_log_handle < 0) {
dlt_user.dlt_log_handle = DLT_FD_INIT;

Expand Down

0 comments on commit a5ea5f1

Please sign in to comment.