Skip to content

fix: avoid using C-style pointers to prevent potential memory leaks#913

Open
SYaoJun wants to merge 3 commits intoapache:mainfrom
SYaoJun:status_330
Open

fix: avoid using C-style pointers to prevent potential memory leaks#913
SYaoJun wants to merge 3 commits intoapache:mainfrom
SYaoJun:status_330

Conversation

@SYaoJun
Copy link
Copy Markdown
Contributor

@SYaoJun SYaoJun commented Mar 30, 2026

Reason for this PR

current Status missing copy assignment operator, which may cause memory leak.
modern cpp guidelines suggent using smart pointer instead of C-type pointer.

In this PR, it uses std::unique_ptr<State> state_; to replace orignal State* state_;

BTW, This memory leak was detected by .clang-tidy.

#898

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@SYaoJun SYaoJun marked this pull request as ready for review March 30, 2026 15:16
@Thespica
Copy link
Copy Markdown
Contributor

Thespica commented Apr 6, 2026

cpp faild to buil

pleas fix that.

SYaoJun added 2 commits April 7, 2026 20:05
Signed-off-by: syaojun <libevent@yeah.net>
Signed-off-by: syaojun <libevent@yeah.net>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.58%. Comparing base (b21da29) to head (3a25e8f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #913      +/-   ##
============================================
- Coverage     80.60%   80.58%   -0.02%     
  Complexity      615      615              
============================================
  Files            94       94              
  Lines         10709    10698      -11     
  Branches       1055     1055              
============================================
- Hits           8632     8621      -11     
  Misses         1837     1837              
  Partials        240      240              
Flag Coverage Δ
cpp 70.84% <100.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants