Fix memory leak of "handlers_" in cpp example (#1464)

This commit is contained in:
Sprite 2021-03-28 09:46:30 +08:00 committed by GitHub
parent cc0d45a01c
commit 0d1c310e32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,6 +172,7 @@ class TdExample {
auto it = handlers_.find(response.request_id); auto it = handlers_.find(response.request_id);
if (it != handlers_.end()) { if (it != handlers_.end()) {
it->second(std::move(response.object)); it->second(std::move(response.object));
handlers_.erase(it);
} }
} }