adafruit / adafruit/Adafruit_IO_Arduino
Error in Arduino_feed.cpp
- Dominant language
- C++
- Stars
- 222
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
This is a failure to free the correct object.
In my source, I have lines 41-42 as
`41. if(_get_pub)`
`42. delete _pub;`
which should actually delete `_get_pub`.
In general, every C++ implementation I have encountered assumes the argument to delete can be NULL, eliminating the need for the test.
In addition, doing delete twice on the same pointer has undefined behavior, and can even corrupt the heap
I was trying to understand why there is a lastValue operation on a feed, but not a group, and did not understand why publishing a zero-length string did anything. If this truly returns the last value for a feed, it solves my problem, sort of, but I'm using a group, and would like to see this extended to cover group feeds.
Contributor guide
No contributing guide indexed for this repository
Research direction
Open Arduino_feed.cpp and inspect lines 41-42, then trace the surrounding cleanup path to confirm which pointer is owned and whether it can be deleted more than once. Done means correcting the invalid deletion behavior; the request to extend lastValue to group feeds needs separate scope and acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100