ret =
CreateClientChannel(instance, kPortTypeMainWrite, sync, &main_client_[1]);
- if (ret != RPC_PORT_ERROR_NONE) return ret;
+ if (ret != RPC_PORT_ERROR_NONE) {
+ main_client_[0].reset();
+ return ret;
+ }
ret = CreateClientChannel(instance, kPortTypeDelegateRead, sync,
&delegate_client_[0]);
- if (ret != RPC_PORT_ERROR_NONE) return ret;
+ if (ret != RPC_PORT_ERROR_NONE) {
+ main_client_[1].reset();
+ main_client_[0].reset();
+ return ret;
+ }
ret = CreateClientChannel(instance, kPortTypeDelegateWrite, sync,
&delegate_client_[1]);
- if (ret != RPC_PORT_ERROR_NONE) return ret;
+ if (ret != RPC_PORT_ERROR_NONE) {
+ delegate_client_[0].reset();
+ main_client_[1].reset();
+ main_client_[0].reset();
+ return ret;
+ }
auto peer_cred =
std::unique_ptr<PeerCred>(PeerCred::Get(main_client_[0]->GetFd()));