Skip to content

Allocation/deallocation bugs #63

Open
@supuflounder

Description

@supuflounder

In traipsing through the code, I found a few more bugs. This list includes the delete _get_pub bug I reported earlier

AdafruitIO_Feed.cpp:    delete _get_pub;    // jmn-bug
AdafruitIO_Group.cpp:    // There is no test to see of _sub and _pub allocations succeeded // jmn-bug
AdafruitIO_Group.cpp:    // If _sub is NULL, the behavior of the remaining method calls    // jmn-bug
AdafruitIO_Group.cpp:    // is undefined                                                   // jmn-bug
AdafruitIO_Group.cpp:    // This code is incorrect; if, for example, _topic was allocated // jmn-bug
AdafruitIO_Group.cpp:    // but _create_url failed, then setting topic to NULL (neé 0)    // jmn-bug
AdafruitIO_Group.cpp:    // will cause a memory leak                                      // jmn-bug
AdafruitIO_Group.cpp:    // correct code would be                                         // jmn-bug
AdafruitIO_Group.cpp:    // if(_topic != NULL)                                            // jmn-bug
AdafruitIO_Group.cpp:    //   { /* has topic */                                           // jmn-bug
AdafruitIO_Group.cpp:    //    free(_topic);                                              // jmn-bug
AdafruitIO_Group.cpp:    //    _topic = NULL;                                             // jmn-bug
AdafruitIO_Group.cpp:    //   } /* has topic */                                           // jmn-bug
AdafruitIO_Group.cpp:    // Repeat for _create_url and _group_url                         // jmn-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions