summaryrefslogtreecommitdiffstats
path: root/src/hs-clientmanager.cpp
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-28 17:23:49 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-11-28 17:26:26 +0800
commitb730d31a7e5e23756ab1b076de21d41369a500c5 (patch)
tree59784664e070438492ddeb96c6abc2a7512d2e67 /src/hs-clientmanager.cpp
parent31ff5ce755d00cf12ea2ffc96c33ed9acd36358f (diff)
fix issue,not free stringguppy_6.99.2guppy/6.99.26.99.2
After called afb_req_get_application_id api needed to free the string. Change-Id: Ia59a3f4984854d61f4c5a8d9206f44988594ebf3 Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Diffstat (limited to 'src/hs-clientmanager.cpp')
-rw-r--r--src/hs-clientmanager.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/hs-clientmanager.cpp b/src/hs-clientmanager.cpp
index ba29326..1355c99 100644
--- a/src/hs-clientmanager.cpp
+++ b/src/hs-clientmanager.cpp
@@ -254,9 +254,13 @@ int HS_ClientManager::subscribe(afb_req_t request)
const char *value = afb_req_value(request, "event");
HMI_NOTICE("homescreen-service","value is %s", value);
if(value) {
- std::string appid(afb_req_get_application_id(request));
- std::lock_guard<std::mutex> lock(this->mtx);
+ std::string appid =std::move(get_application_id(request));
+ if(appid.empty()) {
+ HMI_NOTICE("homescreen-service","can't get application identifier");
+ return AFB_REQ_GETAPPLICATIONID_ERROR;
+ }
+ std::lock_guard<std::mutex> lock(this->mtx);
HS_Client* client = nullptr;
auto ip = client_list.find(appid);
if(ip != client_list.end()) {
@@ -295,9 +299,13 @@ int HS_ClientManager::unsubscribe(afb_req_t request)
HMI_NOTICE("homescreen-service","value is %s", value);
int ret = 0;
if(value) {
- std::string appid(afb_req_get_application_id(request));
- std::lock_guard<std::mutex> lock(this->mtx);
+ std::string appid = std::move(get_application_id(request));
+ if(appid.empty()) {
+ HMI_NOTICE("homescreen-service","can't get application identifier");
+ return AFB_REQ_GETAPPLICATIONID_ERROR;
+ }
+ std::lock_guard<std::mutex> lock(this->mtx);
auto ip = client_list.find(appid);
if(ip != client_list.end()
&& ip->second->unsubscribe(request, value) != 0) {