Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Blackburn2010-05-27 10:01:52 +0000
committerJames Blackburn2010-05-27 10:01:52 +0000
commitb911acf559b72b746127a8820dac1b904dbf2972 (patch)
tree979887e127b0f0dd5eafb1137068b459bf237f07 /core/org.eclipse.cdt.core.linux/src/org/eclipse
parentfce5016ea7812dcd51a5a62e5554f2bc07be8f25 (diff)
downloadorg.eclipse.cdt-b911acf559b72b746127a8820dac1b904dbf2972.tar.gz
org.eclipse.cdt-b911acf559b72b746127a8820dac1b904dbf2972.tar.xz
org.eclipse.cdt-b911acf559b72b746127a8820dac1b904dbf2972.zip
Bug 314504 ProcessList leaks file descriptors during #getProcessList()
Diffstat (limited to 'core/org.eclipse.cdt.core.linux/src/org/eclipse')
-rw-r--r--core/org.eclipse.cdt.core.linux/src/org/eclipse/cdt/internal/core/linux/ProcessList.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core.linux/src/org/eclipse/cdt/internal/core/linux/ProcessList.java b/core/org.eclipse.cdt.core.linux/src/org/eclipse/cdt/internal/core/linux/ProcessList.java
index 3277a672c8d..35e864d1222 100644
--- a/core/org.eclipse.cdt.core.linux/src/org/eclipse/cdt/internal/core/linux/ProcessList.java
+++ b/core/org.eclipse.cdt.core.linux/src/org/eclipse/cdt/internal/core/linux/ProcessList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
+ * Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -60,13 +60,20 @@ public class ProcessList implements IProcessList {
for (int i = 0; i < pidFiles.length; i++) {
File cmdLine = new File(pidFiles[i], "cmdline"); //$NON-NLS-1$
StringBuffer line = new StringBuffer();
+ FileReader reader = null;
try {
- FileReader reader = new FileReader(cmdLine);
+ reader = new FileReader(cmdLine);
int c;
while ((c = reader.read()) > 0) {
line.append((char)c);
}
} catch (IOException e) {
+ } finally {
+ try {
+ if (reader != null)
+ reader.close();
+ } catch (IOException e) {/* Don't care */}
+ reader = null;
}
String name = line.toString();
if (name.length() == 0) {

Back to the top