#4376 new defect

covoar/ReportsBase Coverage::GenerateReports() uses raw pointer to std::list

Reported by: Alex White Owned by:
Priority: normal Milestone: 6.1
Component: tool Version: 6
Severity: normal Keywords: coverage, covoar
Cc: Blocked By:
Blocking:

Description (last modified by Joel Sherrill)

The Coverage::GenerateReports() function uses a variable of type std::list<ReportsBase *> to store the ReportsBase-derived classes used to generate the reports. The function should use an std::vector<std::unique_ptr<ReportsBase>> instead.

An std::vector is the preferred container type in this case because the constant-time insertion and removal properties of std::list are not needed. The smart pointer type std::unique_ptr<ReportsBase> is preferred over ReportsBase * because it eliminates the need for manual pointer deletion at the end of the function.

Change History (1)

comment:1 Changed on Apr 5, 2021 at 6:35:16 PM by Joel Sherrill

Component: admintool
Description: modified (diff)
Keywords: covoar added
Summary: covoar/ReportsBase Coverage::GenerateReports() uses raw pointer std::listcovoar/ReportsBase Coverage::GenerateReports() uses raw pointer to std::list
Note: See TracTickets for help on using tickets.