]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw: use unique_ptr for flat_map emplace in BucketTrimWatcher 52996/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Thu, 2 Mar 2023 13:04:53 +0000 (18:34 +0530)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Sat, 14 Oct 2023 08:03:28 +0000 (15:03 +0700)
commitbfdf19bb221cb939009f67f07ae2c5f61fb319ef
treeb0dbe6c914dc19b22120f30f54102090c9ddb6ad
parent129959fe9d0ef9f0a81dc3637356e2bd1f39bfe8
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/rgw_trim_bilog.cc