mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-04-02 19:50:13 +02:00
Fix memory leak - only track vpin once
This commit is contained in:
parent
0029762fc6
commit
fe24671ad2
@ -233,7 +233,20 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
bool isConfigured(VPIN vpin) const {
|
||||
ConfiguredInput *current = _firstInput;
|
||||
while (current != nullptr) {
|
||||
if (current->getVpin() == vpin) {
|
||||
return true;
|
||||
}
|
||||
current = current->getNext();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void addConfiguredInput(ConfiguredInput *input) {
|
||||
VPIN vpin = input->getVpin();
|
||||
if (isConfigured(vpin)) return; // Already have this captured, don't create it again
|
||||
if (!_firstInput) {
|
||||
_firstInput = input;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user