Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: base/process_util_win.cc

Issue 9689081: Add comments and fix a potential leak in LaunchProcess. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing matching call to CloseHandle(hThread) Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/process_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <io.h> 8 #include <io.h>
9 #include <windows.h> 9 #include <windows.h>
10 #include <userenv.h> 10 #include <userenv.h>
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 &startup_info, &process_info)) { 342 &startup_info, &process_info)) {
343 return false; 343 return false;
344 } 344 }
345 } 345 }
346 346
347 if (options.job_handle) { 347 if (options.job_handle) {
348 if (0 == AssignProcessToJobObject(options.job_handle, 348 if (0 == AssignProcessToJobObject(options.job_handle,
349 process_info.hProcess)) { 349 process_info.hProcess)) {
350 DLOG(ERROR) << "Could not AssignProcessToObject."; 350 DLOG(ERROR) << "Could not AssignProcessToObject.";
351 KillProcess(process_info.hProcess, kProcessKilledExitCode, true); 351 KillProcess(process_info.hProcess, kProcessKilledExitCode, true);
352 CloseHandle(process_info.hProcess);
353 CloseHandle(process_info.hThread);
352 return false; 354 return false;
353 } 355 }
354 356
355 ResumeThread(process_info.hThread); 357 ResumeThread(process_info.hThread);
356 } 358 }
357 359
358 // Handles must be closed or they will leak. 360 // Handles must be closed or they will leak.
359 CloseHandle(process_info.hThread); 361 CloseHandle(process_info.hThread);
360 362
361 if (options.wait) 363 if (options.wait)
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 1004
1003 PERFORMANCE_INFORMATION info; 1005 PERFORMANCE_INFORMATION info;
1004 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { 1006 if (!InternalGetPerformanceInfo(&info, sizeof(info))) {
1005 DLOG(ERROR) << "Failed to fetch internal performance info."; 1007 DLOG(ERROR) << "Failed to fetch internal performance info.";
1006 return 0; 1008 return 0;
1007 } 1009 }
1008 return (info.CommitTotal * system_info.dwPageSize) / 1024; 1010 return (info.CommitTotal * system_info.dwPageSize) / 1024;
1009 } 1011 }
1010 1012
1011 } // namespace base 1013 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698