[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:
Edward Firmo
2026-04-01 10:34:29 +02:00
committed by GitHub
parent 212b3e1688
commit fbfb5d401f
+10 -1
View File
@@ -143,8 +143,17 @@ void Nextion::reset_(bool reset_nextion) {
while (this->available()) { // Clear receive buffer
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();
for (auto *entry : this->waveform_queue_) {
delete entry; // NOLINT(cppcoreguidelines-owning-memory)
}
this->waveform_queue_.clear();
}