Skip to content

Commit

Permalink
Merge pull request #623 from facchinm/i2c_null_pointers_on_end
Browse files Browse the repository at this point in the history
Wire: nullify pointers on end()
  • Loading branch information
facchinm committed Feb 15, 2023
2 parents 74ecea8 + 8c192bf commit 2f8fd83
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ void arduino::MbedI2C::begin(uint8_t slaveAddr) {
void arduino::MbedI2C::end() {
if (master != NULL) {
delete master;
master = NULL;
}
#ifdef DEVICE_I2CSLAVE
if (slave != NULL) {
slave_th->terminate();
slave_th->free_stack();
delete slave_th;
delete slave;
slave = NULL;
}
#endif
}
Expand Down

0 comments on commit 2f8fd83

Please sign in to comment.