Skip to content

Commit

Permalink
Fixed memory leak warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mikljohansson committed Oct 22, 2020
1 parent dead5bc commit 505f888
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ TwoWire::begin(uint8_t sda, uint8_t scl, uint32_t frequency)

is_master_mode = true;

delete i2c_tx_buff, i2c_rx_buff;
delete i2c_tx_buff;
delete i2c_rx_buff;
i2c_tx_buff = new RingBuffer();
i2c_rx_buff = new RingBuffer();

Expand Down Expand Up @@ -88,7 +89,8 @@ TwoWire::begin(uint16_t slave_address, uint8_t sda, uint8_t scl)
plic_irq_register((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num), maix_i2c_slave_irq, this);
plic_irq_enable((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num));

delete i2c_tx_buff, i2c_rx_buff;
delete i2c_tx_buff;
delete i2c_rx_buff;
i2c_tx_buff = new RingBuffer();
i2c_rx_buff = new RingBuffer();

Expand Down

0 comments on commit 505f888

Please sign in to comment.