diff --git a/src/cli/cli_coap.cpp b/src/cli/cli_coap.cpp index 58e1cfe52..f4ecdc244 100644 --- a/src/cli/cli_coap.cpp +++ b/src/cli/cli_coap.cpp @@ -43,6 +43,12 @@ namespace ot { namespace Cli { +Coap::Coap(Interpreter &aInterpreter): + mInterpreter(aInterpreter) +{ + memset(&mResource, 0, sizeof(mResource)); +} + void Coap::PrintPayload(otMessage *aMessage) const { uint8_t buf[kMaxBufferSize]; diff --git a/src/cli/cli_coap.hpp b/src/cli/cli_coap.hpp index 82a1dc37d..db09f0f58 100644 --- a/src/cli/cli_coap.hpp +++ b/src/cli/cli_coap.hpp @@ -60,7 +60,7 @@ public: * @param[in] aInterpreter The CLI interpreter. * */ - Coap(Interpreter &aInterpreter): mInterpreter(aInterpreter) { } + Coap(Interpreter &aInterpreter); /** * This method interprets a list of CLI arguments. diff --git a/src/cli/cli_udp_example.cpp b/src/cli/cli_udp_example.cpp index cc5ab205c..7e16b56ce 100644 --- a/src/cli/cli_udp_example.cpp +++ b/src/cli/cli_udp_example.cpp @@ -54,6 +54,12 @@ const struct UdpExample::Command UdpExample::sCommands[] = { "send", &UdpExample::ProcessSend } }; +UdpExample::UdpExample(Interpreter &aInterpreter): + mInterpreter(aInterpreter) +{ + memset(&mSocket, 0, sizeof(mSocket)); +} + otError UdpExample::ProcessHelp(int argc, char *argv[]) { for (unsigned int i = 0; i < sizeof(sCommands) / sizeof(sCommands[0]); i++) diff --git a/src/cli/cli_udp_example.hpp b/src/cli/cli_udp_example.hpp index fff0e91d7..12a3614a8 100644 --- a/src/cli/cli_udp_example.hpp +++ b/src/cli/cli_udp_example.hpp @@ -57,7 +57,7 @@ public: * @param[in] aInterpreter The CLI interpreter. * */ - UdpExample(Interpreter &aInterpreter): mInterpreter(aInterpreter) { } + UdpExample(Interpreter &aInterpreter); /** * This method interprets a list of CLI arguments.