diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2019-04-02 14:54:08 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2019-04-19 17:30:28 +0200 |
commit | a53418f75db2d4a9f0cb941de812b27024381b07 (patch) | |
tree | 5c094a1b6914251e0f72172b7b8597ecd48edf68 /signal-composer-binding | |
parent | bb271bdb356c5fce11cb1f51bd2ba5500e8b4afa (diff) |
Initializing the source structure.
Make sure that all member's structure are initialized to zero
to avoid unexpected behavior.
Bug-AGL: SPEC-2312
Change-Id: I0e5c3f7c0d5382de92693660d9812daa6735039d
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding')
-rw-r--r-- | signal-composer-binding/signal.cpp | 1 | ||||
-rw-r--r-- | signal-composer-binding/source.cpp | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/signal-composer-binding/signal.cpp b/signal-composer-binding/signal.cpp index 7735a08..713fa20 100644 --- a/signal-composer-binding/signal.cpp +++ b/signal-composer-binding/signal.cpp @@ -310,6 +310,7 @@ void Signal::onReceivedCB(json_object *eventJ) CtlSourceT source; ::memset(&source, 0, sizeof(CtlSourceT)); source.uid = id_.c_str(); + source.api = afbBindingV3root; source.context = (void*)get_context(); if (onReceived_) ActionExecOne(&source, onReceived_, json_object_get(eventJ)); diff --git a/signal-composer-binding/source.cpp b/signal-composer-binding/source.cpp index a33db22..17bcbb4 100644 --- a/signal-composer-binding/source.cpp +++ b/signal-composer-binding/source.cpp @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include <cstring> #include "source.hpp" #include "signal-composer.hpp" @@ -47,7 +48,9 @@ void SourceAPI::init() if(init_) { CtlSourceT source; + ::memset(&source, 0, sizeof(CtlSourceT)); source.uid = init_->uid; + source.api = afbBindingV3root; ActionExecOne(&source, init_, json_object_new_object()); std::string sourceAPI_events = api_ + "/*"; afb_api_event_handler_add(afbBindingV3root, sourceAPI_events.c_str(), SourceAPI::onSourceEvents, NULL); @@ -240,7 +243,9 @@ int SourceAPI::makeSubscription(AFB_ReqT request) if(getSignals_) { CtlSourceT source; + ::memset(&source, 0, sizeof(CtlSourceT)); source.uid = api_.c_str(); + source.api = afbBindingV3root; source.request = request; json_object *argsSaveJ = getSignals_->argsJ; |