brpc icon indicating copy to clipboard operation
brpc copied to clipboard

Memory leak?

Open QiAnXinCodeSafe opened this issue 1 year ago • 1 comments

Hi all, This is Qianxin CodeSafe Team, we found a suspicious issue, at https://github.com/apache/brpc/blob/5cdf22f158722b3b11c7eabb7632690d719ccc4b/src/bthread/task_group.cpp#L230 which is allocating memory at https://github.com/apache/brpc/blob/5cdf22f158722b3b11c7eabb7632690d719ccc4b/src/bthread/task_group.cpp#L81 however,the author did not use any functions to free up memory at https://github.com/apache/brpc/blob/5cdf22f158722b3b11c7eabb7632690d719ccc4b/src/bthread/task_group.cpp#L91 so,there is a memory leak in the pointers 'stk' and 's'.

QiAnXinCodeSafe avatar Oct 22 '24 10:10 QiAnXinCodeSafe

spans likes a tree,the memory will be destoryed from root, see span.cpp void Span::destroy() { EndAsParent(); traversal(this, [](Span* r) { r->_info.clear(); butil::return_object(r); }); }

yanglimingcn avatar Oct 25 '24 01:10 yanglimingcn