Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 3297a1d

Browse files
committed
Fix test code for MockWdmSubscriptionResponder
The test code for managing the binding in the MockWdmSubscriptionResponder. The logic bug was present for some time, but skipped past unnoticed. The core issue is as follows: we grab a reference to `gBinding` when the SubscriptionEngine generates a `kEvent_OnSubscriptionEstablished` (line 654 above the patch); that reference is logically bound to the publisher and no to the client (and to the mutual countersubscription). As a result, the reference to the binding object will be released as a result of SubscriptionEngine generating a `kEvent_OnSubscriptionTerminated`; in this code this takes place as a result of calling `HandlePublisherRelease()` in line 802 below. The error handling takes place via checking for errors in the `exit:` label and takes a form of `EndSubscription()`. As a result of both of these properties, It is a logical error to `Release()` the binding because of a failed call `NewClient()`.
1 parent f10d2af commit 3297a1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test-apps/MockWdmSubscriptionResponder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ void MockWdmSubscriptionResponderImpl::PublisherEventCallback (void * const aApp
737737
aInParam.mSubscriptionEstablished.mHandler->GetBinding(),
738738
responder, ClientEventCallback,
739739
&(responder->mSinkCatalog), kResponseTimeoutMsec * 2);
740-
VerifyOrExit(err == WEAVE_NO_ERROR, gBinding->Release());
740+
SuccessOrExit(err);
741741

742742
// TODO: EVENT-DEMO
743743
responder->mSubscriptionClient->InitiateCounterSubscription(

0 commit comments

Comments
 (0)