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

Greg Clayton gclayton at apple.com
Sun Oct 10 15:07:18 PDT 2010


Author: gclayton
Date: Sun Oct 10 17:07:18 2010
New Revision: 116175

URL: http://llvm.org/viewvc/llvm-project?rev=116175&view=rev
Log:
Plugged 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=116175&r1=116174&r2=116175&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Sun Oct 10 17:07:18 2010
@@ -640,15 +640,16 @@
 #if defined (__APPLE__)
     int num_pids;
     int size_of_pids;
-    int *pid_list;
+    std::vector<int> pid_list;
     
     size_of_pids = proc_listpids(PROC_ALL_PIDS, 0, NULL, 0);
     if (size_of_pids == -1)
         return 0;
         
     num_pids = size_of_pids/sizeof(int);
-    pid_list = (int *) malloc(size_of_pids);
-    size_of_pids = proc_listpids(PROC_ALL_PIDS, 0, pid_list, size_of_pids);
+    
+    pid_list.resize (size_of_pids);
+    size_of_pids = proc_listpids(PROC_ALL_PIDS, 0, &pid_list[0], size_of_pids);
     if (size_of_pids == -1)
         return 0;
         





More information about the lldb-commits mailing list