[rtems-tools commit] Fix buffer leak on error.

Chris Johns chrisj at rtems.org
Mon Nov 3 22:31:02 UTC 2014


Module:    rtems-tools
Branch:    master
Commit:    ddbab71497181085efccc0b0cb42da5d51792439
Changeset: http://git.rtems.org/rtems-tools/commit/?id=ddbab71497181085efccc0b0cb42da5d51792439

Author:    Chris Johns <chrisj at rtems.org>
Date:      Tue Nov  4 09:40:15 2014 +1100

Fix buffer leak on error.

---

 rtemstoolkit/rld-path.cpp |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/rtemstoolkit/rld-path.cpp b/rtemstoolkit/rld-path.cpp
index 585bfe2..333c1c2 100644
--- a/rtemstoolkit/rld-path.cpp
+++ b/rtemstoolkit/rld-path.cpp
@@ -114,7 +114,10 @@ namespace rld
         {
           buf = new char[32 * 1024];
           if (!::getcwd (buf, 32 * 1024))
+          {
+            delete [] buf;
             throw rld::error (::strerror (errno), "get current working directory");
+          }
           path_join (buf, path, apath);
           delete [] buf;
         }



More information about the vc mailing list