From: Mohamed Awnallah Date: Mon, 27 Feb 2023 12:11:02 +0000 (+0200) Subject: src/rgw/rgw_sync_checkpoint.cc: fix bug causing access a destructured temporary varia... X-Git-Tag: v19.0.0~1558^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d2ad3116d8663b011f104ee73ee15679446cbe17;p=ceph.git src/rgw/rgw_sync_checkpoint.cc: fix bug causing access a destructured temporary variable in the empty function at rgw_sync_checkpoint.cc This commit adds a static const empty string at `src/rgw/rgw_sync_checkpoint.cc` that lives in the scope of the `empty` function to avoid access access a destructured temporary variable. Fixes: https://tracker.ceph.com/issues/57516 Signed-off-by: Mohamed Awnallah --- diff --git a/src/rgw/rgw_sync_checkpoint.cc b/src/rgw/rgw_sync_checkpoint.cc index 5e05b0e1271..7ef6c3fc02b 100644 --- a/src/rgw/rgw_sync_checkpoint.cc +++ b/src/rgw/rgw_sync_checkpoint.cc @@ -49,8 +49,9 @@ bool operator<(const std::vector& lhs, bool empty(const BucketIndexShardsManager& markers, int size) { + static const std::string empty_string; for (int i = 0; i < size; ++i) { - const auto& m = markers.get(i, ""); + const auto& m = markers.get(i, empty_string); if (!m.empty()) { return false; }