From 17f61bbffd7269e4787c60b8bb7cc3e61e715bc5 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Fri, 12 Oct 2018 14:29:43 +0200 Subject: afb-api-so-v3: Keep root API in all cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For bindings v3, it is possible to have no explicit default root API. In that case, the binder creates a fake API that references the binding itself. That api isn't callable be it allows to emit messages, to catch events and to call services (other apis). It must be kept to ensure that there is no further error in the hypothetical case where it is used. Bug-AGL: SPEC-1812 Change-Id: I1a6c1e1390411a45521b9a6c1c386dc7807191df Signed-off-by: José Bollo --- src/afb-api-so-v3.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/afb-api-so-v3.c b/src/afb-api-so-v3.c index 373386ef..727e9b69 100644 --- a/src/afb-api-so-v3.c +++ b/src/afb-api-so-v3.c @@ -117,7 +117,14 @@ int afb_api_so_v3_add(const char *path, void *handle, struct afb_apiset *declare export = afb_export_create_none_for_path(declare_set, call_set, path, init, &a); if (export) { - afb_export_unref(export); + /* + * No call is done to afb_export_unref(export) because: + * - legacy applications may use the root API emitting messages + * - it allows writting applications like bindings without API + * But this has the sad effect to introduce a kind of leak. + * To avoid this, if necessary further developement should list bindings + * and their data. + */ return 1; } } -- cgit 1.2.3-korg