Ensure Binder finalizer handles partially initialized instances.

If the Binder is allocated but its constructor does not run for some
reason, then Binder.init() will not be called.  Since the object was
allocated, it is still eligible for finalization.  Eventually when
the finalizer runs and calls Binder.destroy(), it will have a NULL
binder holder pointer.  Previously this would cause Binder.destroy()
to attempt to decrement a reference count on a NULL pointer.

Now we check and ignore the binder if it does not have a valid
holder pointer.

Bug: b/2533956
Change-Id: Ifc2729b2f2abe8bceea5a0645ae0a4c1575b7846
1 file changed