summaryrefslogtreecommitdiffstats
path: root/src/hs-helper.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-helper.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-helper.cpp')
-rw-r--r--src/hs-helper.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/hs-helper.cpp b/src/hs-helper.cpp
index 07597b7..d0f5713 100644
--- a/src/hs-helper.cpp
+++ b/src/hs-helper.cpp
@@ -246,3 +246,28 @@ int hs_search_event_name_index(const char* value)
}
return ret;
}
+
+/**
+ * get application id from request
+ *
+ * #### Parameters
+ * - request : the request
+ *
+ * #### Return
+ * got application id
+ *
+ */
+std::string get_application_id(const afb_req_t request)
+{
+ std::string appid;
+ char *app_id = afb_req_get_application_id(request);
+ if(app_id == nullptr) {
+ appid = std::string("");
+ }
+ else {
+ appid = std::string(app_id);
+ free(app_id);
+ }
+
+ return appid;
+}