Skip to content

rgw: use unique_ptr for flat_map emplace in BucketTrimWatche#50346

Merged
cbodley merged 1 commit intoceph:mainfrom
vedanshbhartia:rm-57938
Mar 11, 2023
Merged

rgw: use unique_ptr for flat_map emplace in BucketTrimWatche#50346
cbodley merged 1 commit intoceph:mainfrom
vedanshbhartia:rm-57938

Conversation

@vedanshbhartia
Copy link
Contributor

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@vedanshbhartia vedanshbhartia requested a review from a team as a code owner March 2, 2023 13:20
@github-actions github-actions bot added the rgw label Mar 2, 2023
@mattbenjamin
Copy link
Contributor

mattbenjamin commented Mar 2, 2023

@vedanshbhartia oh, I see--yuval marked this as a coverity warning. cool!

When emplacing objects into the trim notify handler of
BucketTrimWatcher, use a unique_ptr for the handler so that it is
destroyed if the emplace fails.

Though the destructor is already called, this behaviour cannot be relied
upon. std::map does not exhibit the same behaviour, and would have
leaked memory had it been used instead.

Fixes: https://tracker.ceph.com/issues/57938
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
@vedanshbhartia vedanshbhartia changed the title rgw: check flat_map emplace success in BucketTrimWatcher rgw: use unique_ptr for flat_map emplace in BucketTrimWatche Mar 2, 2023
Copy link
Contributor

@cbodley cbodley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great. thanks for the detailed commit message

@cbodley
Copy link
Contributor

cbodley commented Mar 2, 2023

jenkins test make check

@cbodley
Copy link
Contributor

cbodley commented Mar 11, 2023

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants