[PATCH 1/5] rtemstoolkit: Various coverity related fixes.

Chris Johns chrisj at rtems.org
Mon Aug 6 00:43:18 UTC 2018


---
 rtemstoolkit/rld-elf.cpp     |  1 +
 rtemstoolkit/rld-process.cpp | 21 ++++++++++++++++++---
 rtemstoolkit/rld-rtems.cpp   |  1 -
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/rtemstoolkit/rld-elf.cpp b/rtemstoolkit/rld-elf.cpp
index ace3967..231f2bf 100644
--- a/rtemstoolkit/rld-elf.cpp
+++ b/rtemstoolkit/rld-elf.cpp
@@ -425,6 +425,7 @@ namespace rld
         archive (false),
         writable (false),
         elf_ (0),
+        mtype (0),
         oclass (0),
         ident_str (0),
         ident_size (0),
diff --git a/rtemstoolkit/rld-process.cpp b/rtemstoolkit/rld-process.cpp
index e91796f..30e0605 100644
--- a/rtemstoolkit/rld-process.cpp
+++ b/rtemstoolkit/rld-process.cpp
@@ -83,7 +83,13 @@ namespace rld
 
     temporary_files::~temporary_files ()
     {
-      clean_up ();
+      try
+      {
+        clean_up ();
+      }
+      catch (...)
+      {
+      }
     }
 
     const std::string
@@ -99,6 +105,9 @@ namespace rld
                                                   RLD_PATH_SEPARATOR_STR);
       tempfile_ref ref (name, keep);
       tempfiles.push_back (ref);
+
+      ::free (temp);
+
       return name;
     }
 
@@ -162,8 +171,14 @@ namespace rld
 
     tempfile::~tempfile ()
     {
-      close ();
-      temporaries.erase (_name);
+      try
+      {
+        close ();
+        temporaries.erase (_name);
+      }
+      catch (...)
+      {
+      }
     }
 
     void
diff --git a/rtemstoolkit/rld-rtems.cpp b/rtemstoolkit/rld-rtems.cpp
index 806a2e1..a2dcf82 100644
--- a/rtemstoolkit/rld-rtems.cpp
+++ b/rtemstoolkit/rld-rtems.cpp
@@ -210,7 +210,6 @@ namespace rld
       if (slash == std::string::npos)
         throw rld::error ("Invalid BSP name", _arch_bsp);
       return _arch_bsp.substr (0, slash);
-      std::string bsp  = _arch_bsp.substr (slash + 1);
     }
 
     const std::string
-- 
2.15.1




More information about the devel mailing list