]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw: use unique_ptr for flat_map emplace in BucketTrimWatcher 50346/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 2 Mar 2023 13:04:53 +0000 (18:34 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 2 Mar 2023 13:51:58 +0000 (19:21 +0530)
commit43ef4753eb338781529a7dc8360eab13d56fce85
treeebdf849194a6be3f3abd6a90aea3e064a2f67d6c
parent0ad603862bf3cdd8b551a61ad8ea9691a2f5cb22
rgw: use unique_ptr for flat_map emplace in BucketTrimWatcher

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>
src/rgw/driver/rados/rgw_trim_bilog.cc