8000 Properly release resources before Reset · jpliew/arduino-esp32@4bd1ba0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bd1ba0

Browse files
authored
Properly release resources before Reset
Had not included cleanup for dynamic memory/ Interrupt in Reset() operation. Would cause a memory leak, and Possibly a total failure if Reset() was call. I have not verified how FreeRTOS would handle trying to assign a ISR to an interrupt that is already assigned an ISR?
1 parent 89ab899 commit 4bd1ba0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libraries/Wire/src/Wire.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ void TwoWire::flush(void)
484484

485485
void TwoWire::reset(void)
486486
{
487+
i2cFreeQueue(i2c); // release malloc memory
488+
i2cReleaseISR(i2c); // remove ISR from Interrupt chain
487489
i2cReset( i2c );
488490
i2c = NULL;
489491
begin( sda, scl );

0 commit comments

Comments
 (0)
0