Skip to content

Commit 3e4ba4a

Browse files
committed
fix: delete existing instances
Delete existing FakeArduino instance before creating new.
1 parent fb13f19 commit 3e4ba4a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ArduinoFake.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define USBCON
66
#endif
77

8-
#include <unordered_map>
8+
#include <unordered_map>
99
#include <cstring>
1010
#include <cstdint>
1111
#include <stdexcept>
@@ -122,6 +122,9 @@ class ArduinoFakeContext
122122

123123
void reset(void)
124124
{
125+
if (this->Instances) {
126+
delete this->Instances;
127+
}
125128
this->Instances = new ArduinoFakeInstances();
126129

127130
this->Mocks->Function.Reset();

0 commit comments

Comments
 (0)