diff --git a/src/platform/OpenThread/OpenThreadUtils.cpp b/src/platform/OpenThread/OpenThreadUtils.cpp index 2ceaae6100cbcb..6f89d1a4a28052 100644 --- a/src/platform/OpenThread/OpenThreadUtils.cpp +++ b/src/platform/OpenThread/OpenThreadUtils.cpp @@ -126,9 +126,10 @@ void LogOpenThreadStateChange(otInstance * otInst, uint32_t flags) } #if CHIP_CONFIG_SECURITY_TEST_MODE { - const otNetworkKey * otKey = otThreadGetNetworkKey(otInst); + otNetworkKey otKey; + otThreadGetNetworkKey(otInst, &otKey); for (int i = 0; i < OT_NETWORK_KEY_SIZE; i++) - snprintf(&strBuf[i * 2], 3, "%02X", otKey->m8[i]); + snprintf(&strBuf[i * 2], 3, "%02X", otKey.m8[i]); ChipLogDetail(DeviceLayer, " Network Key: %s", strBuf); } #endif // CHIP_CONFIG_SECURITY_TEST_MODE