From 65969462d1f005ca8b4de9654d88d917bef358e9 Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Wed, 29 Mar 2017 16:35:01 -0700 Subject: [PATCH] memleak: i2c init was getting called twice Removed duplicate call to mraa_i2c_init which was allocating space for the i2c device twice. Signed-off-by: Noel Eck --- src/adc121c021/adc121c021.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adc121c021/adc121c021.cxx b/src/adc121c021/adc121c021.cxx index 41808b9a..cea682ba 100644 --- a/src/adc121c021/adc121c021.cxx +++ b/src/adc121c021/adc121c021.cxx @@ -36,7 +36,7 @@ ADC121C021::ADC121C021(int bus, uint8_t address, float vref) { // setup our i2c link m_i2c = mraa_i2c_init(bus); - if ( !(m_i2c = mraa_i2c_init(bus)) ) + if (!m_i2c) { throw std::invalid_argument(std::string(__FUNCTION__) + ": mraa_i2c_init() failed");