adafruit / adafruit/Adafruit_IO_Arduino

Allocation/deallocation bugs

Open
#63 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
222
Forks
109
PR merge metrics
No merged PRs in 30d

Description

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

```C++
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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the allocation and cleanup paths in AdafruitIO_Feed.cpp and AdafruitIO_Group.cpp, focusing on the lines marked jmn-bug. Trace the listed pointers through failure and deallocation cases. Done means the reported invalid deletion, unchecked allocations, undefined calls, and possible leaks are addressed without introducing new allocation errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.