Skip to content

Commit d205a15

Browse files
committed
memory does not need to be moved
1 parent dc5f754 commit d205a15

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/controller/python/chip/clusters/attribute.cpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -225,23 +225,21 @@ class ReadClientCallback : public ReadClient::Callback
225225

226226
void OnReportEnd() override { gOnReportEndCallback(mAppContext); }
227227

228-
void OnDone(ReadClient *) override
228+
void OnDone(ReadClient * apReadClient) override
229229
{
230230
gOnReadDoneCallback(mAppContext);
231231

232+
delete apReadClient;
232233
delete this;
233234
};
234235

235-
void AdoptReadClient(std::unique_ptr<ReadClient> apReadClient) { mReadClient = std::move(apReadClient); }
236-
237236
void SetAutoResubscribe(bool autoResubscribe) { mAutoResubscribe = autoResubscribe; }
238237

239238
private:
240239
BufferedReadCallback mBufferedReadCallback;
241240

242241
PyObject * mAppContext;
243242

244-
std::unique_ptr<ReadClient> mReadClient;
245243
bool mAutoResubscribe = true;
246244
};
247245

@@ -455,6 +453,7 @@ void pychip_ReadClient_Abort(ReadClient * apReadClient, ReadClientCallback * apC
455453
VerifyOrDie(apReadClient != nullptr);
456454
VerifyOrDie(apCallback != nullptr);
457455

456+
delete apReadClient;
458457
delete apCallback;
459458
}
460459

@@ -602,12 +601,8 @@ PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient,
602601
}
603602
}
604603

605-
*pReadClient = readClient.get();
606-
*pCallback = callback.get();
607-
608-
callback->AdoptReadClient(std::move(readClient));
609-
610-
callback.release();
604+
*pReadClient = readClient.release();
605+
*pCallback = callback.release();
611606

612607
exit:
613608
return ToPyChipError(err);

0 commit comments

Comments
 (0)