Kaydet (Commit) ce757cdd authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1371380 Resource leak on an exceptional path

Change-Id: I278f8d50dfaaa45e582a34e43ddba3b143203796
üst 29a479c3
......@@ -144,7 +144,7 @@ public final class socketAcceptor implements XAcceptor {
}
serv = server;
}
Socket socket;
Socket socket = null;
try {
socket = serv.accept();
if (DEBUG) {
......@@ -165,6 +165,12 @@ public final class socketAcceptor implements XAcceptor {
return new SocketConnection(acceptingDescription, socket);
}
catch(IOException e) {
if (socket != null) {
try {
socket.close();
} catch(IOException ioException) {
}
}
throw new ConnectionSetupException(e);
}
}
......
......@@ -154,9 +154,11 @@ public final class socketConnector implements XConnector {
con = new SocketConnection(connectionDescription, socket);
} catch (IOException e) {
try {
socket.close();
} catch(IOException ioException) {
if (socket != null) {
try {
socket.close();
} catch(IOException ioException) {
}
}
throw new NoConnectException(e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment