Commit c088e521 authored by Olivier Dion's avatar Olivier Dion
Browse files

contrib/pjproject: Add patch that fixes TURN socket leak

Gitlab: #590

Change-Id: Ia2f030e475eb269a7f9ccb7540fd1fc0c80f5a5b
parent d938694f
From a9b3b09128d1e96cfa4a8ccc74d406c5bf1895db Mon Sep 17 00:00:00 2001
From: Olivier Dion <olivier.dion@savoirfairelinux.com>
Date: Mon, 19 Jul 2021 16:49:28 -0400
Subject: [PATCH] pjnath/turn_sock: Fix leak of socket
Opened socket is not closed on binding and quality of service error. The socket
is owned by the active sock only if everything went well.
---
pjnath/src/pjnath/turn_sock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pjnath/src/pjnath/turn_sock.c b/pjnath/src/pjnath/turn_sock.c
index dc6304d9f..b41e32220 100644
--- a/pjnath/src/pjnath/turn_sock.c
+++ b/pjnath/src/pjnath/turn_sock.c
@@ -1195,6 +1195,7 @@ static void turn_on_state(pj_turn_session *sess,
turn_sock->setting.port_range,
max_bind_retry);
if (status != PJ_SUCCESS) {
+ pj_sock_close(sock);
pj_turn_sock_destroy(turn_sock);
return;
}
@@ -1205,6 +1206,7 @@ static void turn_on_state(pj_turn_session *sess,
turn_sock->pool->obj_name, NULL);
if (status != PJ_SUCCESS && !turn_sock->setting.qos_ignore_error)
{
+ pj_sock_close(sock);
pj_turn_sock_destroy(turn_sock);
return;
}
--
2.32.0
......@@ -17,6 +17,7 @@
"0011-fix-turn-shutdown-crash.patch",
"0012-ignore-down-interfaces.patch",
"0013-ignore-addresses-for-RFC7335.patch",
"0014-fix-socket-leak.patch",
"0001-win-config.patch",
"0002-win-vs-gnutls.patch",
"0003-win-vs2017-props.patch"
......
......@@ -58,6 +58,7 @@ pjproject: pjproject-$(PJPROJECT_VERSION).tar.gz .sum-pjproject
$(APPLY) $(SRC)/pjproject/0011-fix-turn-shutdown-crash.patch
$(APPLY) $(SRC)/pjproject/0012-ignore-down-interfaces.patch # TODO remove with 2.12 (https://github.com/pjsip/pjproject/commit/997a468a5e90f9a88a36f543bef85e0fb0af0dfc)
$(APPLY) $(SRC)/pjproject/0013-ignore-addresses-for-RFC7335.patch # TODO remove with 2.12 (https://github.com/pjsip/pjproject/commit/d245ffaf91120fab7bb70e3f46206faeb5b01269)
$(APPLY) $(SRC)/pjproject/0014-fix-socket-leak.patch
ifdef HAVE_ANDROID
$(APPLY) $(SRC)/pjproject/0001-android.patch
endif
......
Supports Markdown
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