summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-04 15:03:51 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-05 09:36:55 +0200
commite555ea5937d28bed78e5abeb490451d8148efe9b (patch)
treed213e33628f742819d2a6f0d9e273d9b1a0124d8 /external
parent86eb7ad2b4488dcd29c21ae3fc525056b681e199 (diff)
cid#1546341 Resource leak on an exceptional path
Change-Id: Ia4d91ecb2bbd1d325a801b0b40ab478dc5dd3102 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157560 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'external')
-rw-r--r--external/java_websocket/UnpackedTarball_java_websocket.mk1
-rw-r--r--external/java_websocket/patches/0001-cid-1546341-Resource-leak-on-an-exceptional-path.patch40
2 files changed, 41 insertions, 0 deletions
diff --git a/external/java_websocket/UnpackedTarball_java_websocket.mk b/external/java_websocket/UnpackedTarball_java_websocket.mk
index d468adf65057..5b619c2c9e92 100644
--- a/external/java_websocket/UnpackedTarball_java_websocket.mk
+++ b/external/java_websocket/UnpackedTarball_java_websocket.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,java_websocket,\
external/java_websocket/patches/0001-cid-1545227-Dm-Dubious-method-used.patch \
external/java_websocket/patches/0001-cid-1545515-Dm-Dubious-method-used.patch \
external/java_websocket/patches/0001-cid-1546264-Dm-Dubious-method-used.patch \
+ external/java_websocket/patches/0001-cid-1546341-Resource-leak-on-an-exceptional-path.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/java_websocket/patches/0001-cid-1546341-Resource-leak-on-an-exceptional-path.patch b/external/java_websocket/patches/0001-cid-1546341-Resource-leak-on-an-exceptional-path.patch
new file mode 100644
index 000000000000..8c388f2ef287
--- /dev/null
+++ b/external/java_websocket/patches/0001-cid-1546341-Resource-leak-on-an-exceptional-path.patch
@@ -0,0 +1,40 @@
+From 77aac6a0be7a22dc63fd449a8292ff0b83dcb005 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
+Date: Tue, 3 Oct 2023 11:06:35 +0100
+Subject: [PATCH] cid#1546341 Resource leak on an exceptional path
+
+---
+ .../java_websocket/server/WebSocketServer.java | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/src/main/java/org/java_websocket/server/WebSocketServer.java b/src/main/java/org/java_websocket/server/WebSocketServer.java
+index bb8178c..36e19a7 100644
+--- a/src/main/java/org/java_websocket/server/WebSocketServer.java
++++ b/src/main/java/org/java_websocket/server/WebSocketServer.java
+@@ -473,10 +473,19 @@ public abstract class WebSocketServer extends AbstractWebSocket implements Runna
+ if (channel == null) {
+ return;
+ }
+- channel.configureBlocking(false);
+- Socket socket = channel.socket();
+- socket.setTcpNoDelay(isTcpNoDelay());
+- socket.setKeepAlive(true);
++ try {
++ channel.configureBlocking(false);
++ Socket socket = channel.socket();
++ socket.setTcpNoDelay(isTcpNoDelay());
++ socket.setKeepAlive(true);
++ } catch (IOException ex) {
++ try {
++ channel.close();
++ } catch (IOException e) {
++ // there is nothing that must be done here
++ }
++ throw ex;
++ }
+ WebSocketImpl w = wsf.createWebSocket(this, drafts);
+ w.setSelectionKey(channel.register(selector, SelectionKey.OP_READ, w));
+ try {
+--
+2.41.0
+