]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw: use unique_ptr for flat_map emplace in BucketTrimWatcher 51026/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 2 Mar 2023 13:04:53 +0000 (18:34 +0530)
committerCasey Bodley <cbodley@redhat.com>
Tue, 11 Apr 2023 13:45:28 +0000 (09:45 -0400)
commitd8e5e61783ce6999fa35901960218a89be7188dc
treee6d27e9b3fc0087a91f80b710c1e20e281d010d2
parent66f2427e85b86dcf72b8c311def3b942dddbecc6
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>
(cherry picked from commit 43ef4753eb338781529a7dc8360eab13d56fce85)
src/rgw/driver/rados/rgw_trim_bilog.cc