Commit 1a3ab76f authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud

pjproject: fix crash if turn_alloc fails

Because the candidate is destroyed if turn_alloc fails, the
candidate should be committed before turn_alloc and turn_create.

Change-Id: I84f7a206ef42c2a21049d0bea135f5f60c92c0ad
parent de0969ad
...@@ -27,6 +27,7 @@ if "%NO_AUTO%"=="" ( ...@@ -27,6 +27,7 @@ if "%NO_AUTO%"=="" (
) )
set UNIXPATH=%SRC:\=/% set UNIXPATH=%SRC:\=/%
set UNIXPATH=%ROOTPATH%%UNIXPATH:C:/=% set UNIXPATH=%ROOTPATH%%UNIXPATH:C:/=%
bash -c "%PATCH_CMD% %UNIXPATH%pjproject/fix_turn_alloc_failure.patch"
bash -c "%PATCH_CMD% %UNIXPATH%pjproject/ipv6.patch" bash -c "%PATCH_CMD% %UNIXPATH%pjproject/ipv6.patch"
bash -c "%PATCH_CMD% %UNIXPATH%pjproject/multiple_listeners.patch" bash -c "%PATCH_CMD% %UNIXPATH%pjproject/multiple_listeners.patch"
bash -c "%PATCH_CMD% %UNIXPATH%pjproject/pj_ice_sess.patch" bash -c "%PATCH_CMD% %UNIXPATH%pjproject/pj_ice_sess.patch"
......
pjnath/src/pjnath/ice_strans.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index ca15a74e8..040ab4595 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -396,6 +396,9 @@ static pj_status_t add_update_turn(pj_ice_strans *ice_st,
data->comp = comp;
data->transport_id = cand->transport_id;
+ /* Commit the relayed candidate. */
+ comp->cand_cnt++;
+
/* Create the TURN transport */
status = pj_turn_sock_create(&ice_st->cfg.stun_cfg, turn_cfg->af,
turn_cfg->conn_type,
@@ -420,9 +423,6 @@ static pj_status_t add_update_turn(pj_ice_strans *ice_st,
return status;
}
- /* Commit the relayed candidate. */
- comp->cand_cnt++;
-
PJ_LOG(4,(ice_st->obj_name,
"Comp %d/%d: TURN relay candidate (tpid=%d) "
"waiting for allocation",
...@@ -54,6 +54,7 @@ endif ...@@ -54,6 +54,7 @@ endif
ifdef HAVE_ANDROID ifdef HAVE_ANDROID
$(APPLY) $(SRC)/pjproject/android.patch $(APPLY) $(SRC)/pjproject/android.patch
endif endif
$(APPLY) $(SRC)/pjproject/fix_turn_alloc_failure.patch
$(APPLY) $(SRC)/pjproject/rfc2466.patch $(APPLY) $(SRC)/pjproject/rfc2466.patch
$(APPLY) $(SRC)/pjproject/ipv6.patch $(APPLY) $(SRC)/pjproject/ipv6.patch
$(APPLY) $(SRC)/pjproject/multiple_listeners.patch $(APPLY) $(SRC)/pjproject/multiple_listeners.patch
......
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