spindle_logd does not delete heap allocations
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 110
- Forks
- 35
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 2
Description
### Bug:
`MsgReader` allocates a new connection onto the heap but delete is never called on the connection
Allocation:
https://github.com/llnl/Spindle/blob/585dacff6734eb039d318577711d47c5b950699c/src/logging/spindle_logd.cc#L408
#### Connection cleanup
Only removes the connection from the map:
https://github.com/llnl/Spindle/blob/585dacff6734eb039d318577711d47c5b950699c/src/logging/spindle_logd.cc#L476-L478
Only closes the file descriptor and clears the map:
https://github.com/llnl/Spindle/blob/585dacff6734eb039d318577711d47c5b950699c/src/logging/spindle_logd.cc#L594-L600
### Fix:
Two options:
```
for (std::map::iterator i = conns.begin(); i != conns.end(); i++) {
if (i->second->shutdown) {
delete i->second;
conns.erase(i);
```
```
~MsgReader()
{
for (std::map::iterator i = conns.begin(); i != conns.end(); i++) {
int fd = i->first;
close(fd);
delete i->second;
}
conns.clear();
```
Or swap to an `std::unique_ptr`:
```
std::map> conns;
...
Connection *con = std::make_unique();
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/logging/spindle_logd.cc at the MsgReader allocation and the connection cleanup paths around lines 476-478 and 594-600. Trace how Connection objects are stored and removed, then verify that shutdown and individual connection cleanup release each allocation without invalidating the map iteration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100