mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
[nextion] Fix memory leak in reset_() (#15344)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
pre-commit-ci-lite[bot]
parent
212b3e1688
commit
fbfb5d401f
@@ -143,8 +143,17 @@ void Nextion::reset_(bool reset_nextion) {
|
|||||||
|
|
||||||
while (this->available()) { // Clear receive buffer
|
while (this->available()) { // Clear receive buffer
|
||||||
this->read_byte(&d);
|
this->read_byte(&d);
|
||||||
};
|
}
|
||||||
|
for (auto *entry : this->nextion_queue_) {
|
||||||
|
if (entry->component != nullptr && entry->component->get_queue_type() == NextionQueueType::NO_RESULT) {
|
||||||
|
delete entry->component; // NOLINT(cppcoreguidelines-owning-memory)
|
||||||
|
}
|
||||||
|
delete entry; // NOLINT(cppcoreguidelines-owning-memory)
|
||||||
|
}
|
||||||
this->nextion_queue_.clear();
|
this->nextion_queue_.clear();
|
||||||
|
for (auto *entry : this->waveform_queue_) {
|
||||||
|
delete entry; // NOLINT(cppcoreguidelines-owning-memory)
|
||||||
|
}
|
||||||
this->waveform_queue_.clear();
|
this->waveform_queue_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user