[PATCH v1 5/6] DesiredSymbols.cc: Fix resource leak

Ryan Long ryan.long at oarcorp.com
Fri May 28 20:08:17 UTC 2021


CID 1503018: Resource leak in load().

Closes #4421
---
 tester/covoar/DesiredSymbols.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tester/covoar/DesiredSymbols.cc b/tester/covoar/DesiredSymbols.cc
index 2866dbe..5278891 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -101,7 +101,7 @@ namespace Coverage {
       for (auto& kv : symbols.globals()) {
         const rld::symbols::symbol& sym = *(kv.second);
         if (sym.type() == sym.st_func) {
-          set[sym.name()] = *(new SymbolInformation);
+          set[sym.name()] = SymbolInformation();
           setNamesToSymbols[setName].push_back(sym.name());
         }
       }
@@ -109,7 +109,7 @@ namespace Coverage {
       for (auto& kv : symbols.weaks()) {
         const rld::symbols::symbol& sym = *(kv.second);
         if (sym.type() == sym.st_func) {
-          set[sym.name()] = *(new SymbolInformation);
+          set[sym.name()] = SymbolInformation();
           setNamesToSymbols[setName].push_back(sym.name());
         }
       }
-- 
1.8.3.1



More information about the devel mailing list