Skip to content

Commit

Permalink
alias_resolve: add missing nullptr checks to xa_resolve_subst
Browse files Browse the repository at this point in the history
xa_refresh_thread() runs asynchronously and has not necessarily
completed a run before the first time xa_resolve_subst() is invoked.

Fixes: gromox-2.14-63-gfc3305283
Fixes: gromox-2.14-64-g75d12be7a
References: GXL-301
  • Loading branch information
jengelh committed Oct 11, 2024
1 parent 3267bbf commit 88932bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mda/alias_resolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ using namespace alias_resolve;

static std::atomic<bool> xa_notify_stop{false};
static std::condition_variable xa_thread_wake;
static alias_map xa_empty_alias_map;
static domain_set xa_empty_domain_set;
static std::shared_ptr<alias_map> xa_alias_map;
static std::shared_ptr<domain_set> xa_domain_set;
static std::mutex xa_alias_lock;
Expand Down Expand Up @@ -177,8 +179,8 @@ static hook_result xa_alias_subst(MESSAGE_CONTEXT *ctx) try
alias_map_ptr = xa_alias_map;
domset_ptr = xa_domain_set;
}
auto &alias_map = *alias_map_ptr;
auto &domset = *domset_ptr;
auto &alias_map = alias_map_ptr != nullptr ? *alias_map_ptr : xa_empty_alias_map;
auto &domset = domset_ptr != nullptr ? *domset_ptr : xa_empty_domain_set;

auto ctrl = &ctx->ctrl;
if (strchr(ctrl->from, '@') != nullptr) {
Expand Down

0 comments on commit 88932bc

Please sign in to comment.