Project

General

Profile

Cleanup #57938

relying on boost flatmap emplace behavior is risky

Added by Yuval Lifshitz 3 months ago.

Status:
New
Priority:
Low
Assignee:
-
Target version:
-
% Done:

0%

Tags:
low-hanging-fruit
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

see coverity issue: http://folio07.front.sepia.ceph.com/main/ceph-main-98d41855/cov-main-html/3/2253rgw_trim_bilog.cc.html#error
in "BucketTrimWatcher" we emplace a pointer into a boost flatmap without checking whether the operation was successful.
in case of boost flatmap, the ctor is called even if the emplace fails, so the operation does not leak. however, in std::map this is not the case and memory would leak.
see: https://godbolt.org/z/6nzP4T5fb

Also available in: Atom PDF