[Lldb-commits] [lldb] r123357 - /lldb/trunk/source/Host/common/Host.cpp

Greg Clayton gclayton at apple.com
Wed Jan 12 17:27:55 PST 2011


Author: gclayton
Date: Wed Jan 12 19:27:55 2011
New Revision: 123357

URL: http://llvm.org/viewvc/llvm-project?rev=123357&view=rev
Log:
Plug Free BSD memory leak.

Modified:
    lldb/trunk/source/Host/common/Host.cpp

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=123357&r1=123356&r2=123357&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Wed Jan 12 19:27:55 2011
@@ -630,9 +630,10 @@
         size_t exe_path_size;
         if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0)
         {
-          char *exe_path = new char[exe_path_size];
-          if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
-              g_program_filespec.SetFile(exe_path, false);
+            char *exe_path = new char[exe_path_size];
+            if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
+                g_program_filespec.SetFile(exe_path, false);
+            delete[] exe_path;
         }
 #endif
     }





More information about the lldb-commits mailing list