Mbed-os: EventQueue unchain + delete = hardfault

Created on 17 Nov 2016  路  2Comments  路  Source: ARMmbed/mbed-os

Description

  • Type: Bug
  • Priority: Minor

Bug

Target
K64F

Toolchain:
GCC_ARM

mbed-os sha:
(git log -n1 --oneline)
f6f872a, aeabcc9 (at least)

Expected behavior
This doesn't cause a hard fault:

    EventQueue *eq1 = new EventQueue();
    EventQueue *eq2 = new EventQueue();
    eq2->chain(eq1);
    eq2->chain(NULL);
    delete eq2;
    delete eq1;

Actual behavior
Hard fault at line: delete eq2;
Hard fault doesn't happen if eq2->chain(NULL); is removed.

Steps to reproduce
Drop the above lines directly into for example mbed-os-example-blinky.

bug

Most helpful comment

Nice :) Seems to work fine with #3300.

All 2 comments

Thanks for reporting this! Looks like the chain function simply didn't check for null like it should have. Should be fixed (with tests) by #3300, let us know if there is still a bug.

Nice :) Seems to work fine with #3300.

Was this page helpful?
0 / 5 - 0 ratings