fix(lsock): handle initialization failures and cleanup trace resources - #152
yuKing123-king wants to merge 1 commit into
Conversation
8fe7934 to
2f3d7e5
Compare
PR Reviewer Guide 🔍(Review updated until commit 76882f8)Here are some key observations to aid the review process:
|
2f3d7e5 to
e7d6a4e
Compare
|
Persistent review updated to latest commit e7d6a4e |
Signed-off-by: Wang Yu <wangyu6@uniontech.com>
e7d6a4e to
76882f8
Compare
|
Persistent review updated to latest commit 76882f8 |
这里代码中err_out:里面是有delete rb的。所以以上结论是ai误判了 err_out:
trace.stop();
err_out_before_trace:
if (obj)
{
lsock_bpf::detach(obj); // Detach BPF program
lsock_bpf::destroy(obj); // Clean up BPF object
}
if (cb)
{
delete cb;
}
return -1;
}
#endif |
修复 lsock 初始化阶段异常未处理和错误路径资源清理不完整的问题。
主要修改:
修复原因:
原实现中 CircleBuf 创建、BPF 初始化等操作可能抛出异常,未捕获时会导致工具直接终止。同时,BPF 初始化失败后如果没有停止 Trace,可能残留 trace 线程或保持 tracing 开启状态。