mirror of
https://github.com/esphome/esphome.git
synced 2026-05-31 17:06:40 +08: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:
@@ -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