Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d027a47 authored by Steven Moreland's avatar Steven Moreland
Browse files

RPC Binder: ABinderRpc_Accessor is not RefBase

This object inherited from RefBase, but it is only/
constructed/deleted. This creates a leak and logspam,
and we do want all RefBase objects to be managed with
RefBase, otherwise if they are accidentally passed
into sp<> constructors (in libraries that use the
default implicit constructor), it could accidentally
create double-ownership. So removing RefBase parent
class since it is not needed.

Fixes: 419661001
Test: binderRpcTest (with RefBase warnings as fatal errors)
Change-Id: If6cb6f401986e9f09509e00f61b22146b23b4408
parent f68c5f1c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ struct ABinderRpc_ConnectionInfo {
    std::variant<sockaddr_vm, sockaddr_un, sockaddr_in> addr;
};

struct ABinderRpc_Accessor final : public ::android::RefBase {
struct ABinderRpc_Accessor final {
    static ABinderRpc_Accessor* make(const char* instance, const sp<IBinder>& binder) {
        LOG_ALWAYS_FATAL_IF(binder == nullptr, "ABinderRpc_Accessor requires a non-null binder");
        status_t status = android::validateAccessor(String16(instance), binder);
@@ -61,7 +61,7 @@ struct ABinderRpc_Accessor final : public ::android::RefBase {
    ~ABinderRpc_Accessor() { LOG_ACCESSOR_DEBUG("ABinderRpc_Accessor dtor"); }

   private:
    ABinderRpc_Accessor(sp<IBinder> accessor) : mAccessorBinder(accessor) {}
    ABinderRpc_Accessor(const sp<IBinder>& accessor) : mAccessorBinder(accessor) {}
    ABinderRpc_Accessor() = delete;
    sp<IBinder> mAccessorBinder;
};