diff --git a/lib/livestatus/commandstable.cpp b/lib/livestatus/commandstable.cpp index d41905ede..f3891086f 100644 --- a/lib/livestatus/commandstable.cpp +++ b/lib/livestatus/commandstable.cpp @@ -106,11 +106,11 @@ Value CommandsTable::CustomVariableNamesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(command); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + { ObjectLock xlock(vars); for (const auto& kv : vars) { @@ -135,11 +135,11 @@ Value CommandsTable::CustomVariableValuesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(command); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + { ObjectLock xlock(vars); for (const auto& kv : vars) { @@ -164,11 +164,11 @@ Value CommandsTable::CustomVariablesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(command); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + { ObjectLock xlock(vars); for (const auto& kv : vars) { diff --git a/lib/livestatus/contactstable.cpp b/lib/livestatus/contactstable.cpp index e83127d75..c83865a93 100644 --- a/lib/livestatus/contactstable.cpp +++ b/lib/livestatus/contactstable.cpp @@ -210,11 +210,11 @@ Value ContactsTable::CustomVariableNamesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(user); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { cv->Add(kv.first); @@ -237,11 +237,11 @@ Value ContactsTable::CustomVariableValuesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(user); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { if (kv.second.IsObjectType() || kv.second.IsObjectType()) @@ -267,11 +267,11 @@ Value ContactsTable::CustomVariablesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(user); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { Array::Ptr key_val = new Array(); diff --git a/lib/livestatus/hoststable.cpp b/lib/livestatus/hoststable.cpp index b7199b4b1..7e4a5bb30 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -1016,11 +1016,11 @@ Value HostsTable::CustomVariableNamesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(host); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { cv->Add(kv.first); @@ -1043,11 +1043,11 @@ Value HostsTable::CustomVariableValuesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(host); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { if (kv.second.IsObjectType() || kv.second.IsObjectType()) @@ -1073,11 +1073,11 @@ Value HostsTable::CustomVariablesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(host); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { Array::Ptr key_val = new Array(); diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index 74acd8cf8..e2edf8481 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -1055,11 +1055,11 @@ Value ServicesTable::CustomVariableNamesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(service); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { cv->Add(kv.first); @@ -1082,11 +1082,11 @@ Value ServicesTable::CustomVariableValuesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(service); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { if (kv.second.IsObjectType() || kv.second.IsObjectType()) @@ -1112,11 +1112,11 @@ Value ServicesTable::CustomVariablesAccessor(const Value& row) vars = CompatUtility::GetCustomAttributeConfig(service); } - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + ObjectLock olock(vars); for (const Dictionary::Pair& kv : vars) { Array::Ptr key_val = new Array(); diff --git a/lib/livestatus/statustable.cpp b/lib/livestatus/statustable.cpp index f9f7b57fa..90e311bf5 100644 --- a/lib/livestatus/statustable.cpp +++ b/lib/livestatus/statustable.cpp @@ -233,11 +233,11 @@ Value StatusTable::CustomVariableNamesAccessor(const Value&) { Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars(); - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + { ObjectLock olock(vars); for (const auto& kv : vars) { @@ -252,11 +252,11 @@ Value StatusTable::CustomVariableValuesAccessor(const Value&) { Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars(); - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + { ObjectLock olock(vars); for (const auto& kv : vars) { @@ -271,11 +271,11 @@ Value StatusTable::CustomVariablesAccessor(const Value&) { Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars(); - if (!vars) - return Empty; - Array::Ptr cv = new Array(); + if (!vars) + return cv; + { ObjectLock olock(vars); for (const auto& kv : vars) {