X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fsession.c;h=326b16af067777cd792a580851f31bf9dd754f05;hb=146f95b776c7a424e672b27386fbb8392bc0ffb7;hp=22e50cfc5075a8400c9657fdf4718d951d62f9c1;hpb=b5cf93aed93e7f331eb645c8afe5317fb67ee50e;p=src%2Fapp-framework-binder.git diff --git a/src/session.c b/src/session.c index 22e50cfc..326b16af 100644 --- a/src/session.c +++ b/src/session.c @@ -197,11 +197,10 @@ static void ctxStoreCleanUp (time_t now) // Loop on Sessions Table and remove anything that is older than timeout for (idx=0; idx < sessions.max; idx++) { - ctx = ctxClientAddRef(sessions.store[idx]); + ctx = sessions.store[idx]; if (ctx != NULL && ctxStoreTooOld(ctx, now)) { ctxClientClose (ctx); } - ctxClientUnref(ctx); } } @@ -291,6 +290,10 @@ void ctxClientClose (struct AFB_clientCtx *clientCtx) ctxUuidFreeCB (clientCtx); while(clientCtx->listeners != NULL) ctxClientEventListenerRemove(clientCtx, clientCtx->listeners->listener); + if (clientCtx->refcount == 0) { + ctxStoreDel (clientCtx); + free(clientCtx); + } } }