adafruit / Adafruit_INA219

INA219 Current Sensor
Other
204 stars 145 forks source link

Fix memory leak in Adafruit_INA_219::begin() in subsequent calls #44

Closed FlavorJ closed 3 years ago

FlavorJ commented 3 years ago

Scope: Adds a null-pointer check on i2c_dev in begin() to avoid memory leak if begin() is called more than once, e.g. if begin() fails the first time. Adds destructor to class.

Limitations: Does not address memory issues with default shallow copy constructor.

ladyada commented 3 years ago

great PR! thank you :) please let me know when it passes CI and we can merge!

FlavorJ commented 3 years ago

@ladyada This one's good too.