summaryrefslogtreecommitdiffstats
path: root/src/hs-proxy.cpp
diff options
context:
space:
mode:
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>2021-02-01 11:44:05 +0800
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2021-02-08 18:34:45 +0000
commit3d3afa16bc3f4e8d15c57cd380b4c0e2fc3c3557 (patch)
tree051e496c8c95a972dc926c99bf2b445fdd39aad9 /src/hs-proxy.cpp
parentd63beea6a15c67936791739436f8b9c2de8387b2 (diff)
Fix potential memory leakkoi_11.0.0koi/11.0.011.0.0
json structure allocating code should be placed in where it is used, if there is a condition check which may cause a return before the before-mentioned place in the function. Bug-AGL: SPEC-3584 Change-Id: I5f88c7ce0b9257b2782144548f11a0e1d7ab388a Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
Diffstat (limited to 'src/hs-proxy.cpp')
-rw-r--r--src/hs-proxy.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/hs-proxy.cpp b/src/hs-proxy.cpp
index 33e5d53..33cfce3 100644
--- a/src/hs-proxy.cpp
+++ b/src/hs-proxy.cpp
@@ -154,7 +154,6 @@ int HS_AfmMainProxy::detail(afb_api_t api, const std::string &id, struct json_ob
*/
void HS_AfmMainProxy::start(struct hs_instance *instance, afb_req_t request, const std::string &id)
{
- struct json_object *args = json_object_new_string(id.c_str());
struct closure_data *cdata;
/* tentatively store the client and client context, as the afb_req_t
@@ -187,5 +186,5 @@ void HS_AfmMainProxy::start(struct hs_instance *instance, afb_req_t request, con
AFB_WARNING("Failed to handle subcribe\n");
}
- api_call(request->api, _afm_main, __FUNCTION__, args, cdata);
+ api_call(request->api, _afm_main, __FUNCTION__, json_object_new_string(id.c_str()), cdata);
}