SelectiveChannel AddChannel失败,用户是否需要删除Channel指针?
Open
bug
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
**Describe the bug (描述bug)**
我看AddChannel函数里失败的情况,有的调用了delete sub_chan , 有的没调用。
用户侧不调用删除的话,恐怕有内存泄露;调用删除的话,可能会有double free的风险。
**To Reproduce (复现方法)**
**Expected behavior (期望行为)**
**Versions (各种版本)**
OS:
Compiler:
brpc:
protobuf:
**Additional context/screenshots (更多上下文/截图)**
Contributor guide
Research direction
Start by reading SelectiveChannel::AddChannel and tracing every failure path involving sub_chan, comparing which paths call delete. Determine and document the ownership contract for callers, then verify the failure cases do not permit either a leak or double free.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100