Skip to content
Snippets Groups Projects
Commit 8396e035 authored by Scott Murray's avatar Scott Murray
Browse files

Fix JSON response lifecycle issues


Move json_object_put calls to fix lifecycle issues exposed by the
json-c upgrade with OE thud.  In the newer version, an extra put
now triggers an assertion, so rework the affected logic to only call
put when needed in the failed request cases.

Bug-AGL: SPEC-2707

Signed-off-by: default avatarScott Murray <scott.murray@konsulko.com>
Change-Id: Ia111e408abf515e3ea7b105c66c1339daa759a87
parent f14ecdd5
No related branches found
No related tags found
No related merge requests found
...@@ -60,10 +60,10 @@ void OnRequestNavicoreGetPosition(afb_req req) ...@@ -60,10 +60,10 @@ void OnRequestNavicoreGetPosition(afb_req req)
{ {
AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__); AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
afb_req_fail(req, "failed", "navicore_getposition Bad Request"); afb_req_fail(req, "failed", "navicore_getposition Bad Request");
}
// Json object release // Json object release
json_object_put(response.json_data); json_object_put(response.json_data);
}
AFB_REQ_NOTICE(req, "<-- End %s()", __func__); AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
} }
...@@ -98,10 +98,10 @@ void OnRequestNavicoreGetAllRoutes(afb_req req) ...@@ -98,10 +98,10 @@ void OnRequestNavicoreGetAllRoutes(afb_req req)
{ {
AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__); AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
afb_req_fail(req, "failed", "navicore_getallroutes Bad Request"); afb_req_fail(req, "failed", "navicore_getallroutes Bad Request");
}
// json object release // json object release
json_object_put(response.json_data); json_object_put(response.json_data);
}
AFB_REQ_NOTICE(req, "<-- End %s()", __func__); AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
} }
...@@ -146,10 +146,10 @@ void OnRequestNavicoreCreateRoute(afb_req req) ...@@ -146,10 +146,10 @@ void OnRequestNavicoreCreateRoute(afb_req req)
{ {
AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__); AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
afb_req_fail(req, "failed", "navicore_createroute Bad Request"); afb_req_fail(req, "failed", "navicore_createroute Bad Request");
}
// json object release // json object release
json_object_put(response.json_data); json_object_put(response.json_data);
}
AFB_REQ_NOTICE(req, "<-- End %s()", __func__); AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
} }
...@@ -365,10 +365,10 @@ void OnRequestNavicoreGetAllSessions(afb_req req) ...@@ -365,10 +365,10 @@ void OnRequestNavicoreGetAllSessions(afb_req req)
{ {
AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__); AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
afb_req_fail(req, "failed", "navicore_getallsessions Bad Request"); afb_req_fail(req, "failed", "navicore_getallsessions Bad Request");
}
// json object release // json object release
json_object_put(response.json_data); json_object_put(response.json_data);
}
AFB_REQ_NOTICE(req, "<-- End %s()", __func__); AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment