X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-stub-ws.c;h=02070f466261c68ea19451bfc6191fffc0771105;hb=6415858bb8daa5f0c29392f18e7a230136916ec1;hp=70c74b65bbd65f5fb9049267a26eb9ebb92fab3c;hpb=043c27c3a8fd323d59e41288b6fd24f0e9bfa9a3;p=src%2Fapp-framework-binder.git diff --git a/src/afb-stub-ws.c b/src/afb-stub-ws.c index 70c74b65..02070f46 100644 --- a/src/afb-stub-ws.c +++ b/src/afb-stub-ws.c @@ -266,6 +266,7 @@ static void client_api_call_cb(void * closure, struct afb_xreq *xreq) return; } + afb_xreq_unhooked_addref(xreq); rc = afb_proto_ws_client_call( proto, xreq->request.called_verb, @@ -273,10 +274,10 @@ static void client_api_call_cb(void * closure, struct afb_xreq *xreq) afb_session_uuid(xreq->context.session), xreq, xreq_on_behalf_cred_export(xreq)); - if (rc >= 0) - afb_xreq_unhooked_addref(xreq); - else + if (rc < 0) { afb_xreq_reply(xreq, NULL, "internal", "can't send message"); + afb_xreq_unhooked_unref(xreq); + } } static void client_on_description_cb(void *closure, struct json_object *data)