Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad free() in begin() #12

Open
Blake-Ballew opened this issue Sep 23, 2024 · 0 comments
Open

Bad free() in begin() #12

Blake-Ballew opened this issue Sep 23, 2024 · 0 comments

Comments

@Blake-Ballew
Copy link

Hi all,

I'm experiencing crashes attempting to initialize an LSM303AGR compass. This crash occurs during begin() and seems to be due to
an uninitialized pointer being deleted on line 71 of Adafruit_LSM303_Accel.cpp. begin() seems to work fine if i2c_dev is initialized to NULL.

Code:

    LSM303AGR()
    {
        #if DEBUG == 1
        Serial.println("Compass LSM303AGR::LSM303AGR: Initializing");
        #endif

        if (!_CompassMagnetometer.begin())
        {
            Serial.println("Compass LSM303AGR::LSM303AGR: Magnetometer not found");
        }

        #if DEBUG == 1
        Serial.println("_CompassMagnetometer Initialized");
        #endif

        if (!_CompassAccelerometer.begin())
        {
            Serial.println("Compass LSM303AGR::LSM303AGR: Accelerometer not found");
        }

        Serial.println("Compass LSM303AGR::LSM303AGR: Initialized");
    }
  • Arduino board: ESP32-WROOM-32E(16MB)

  • Arduino IDE version (found in Arduino -> About Arduino menu): arduino-esp32 2.0.16 in platformio

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

  • Create Adafruit_LSM303_Accel_Unified object

  • Program crashes upon accel.begin() for using a bad free().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant