Browse code

Merge pull request #2278 from kamailio/grumvalski/siptrace_ack_fix

siptrace: safety check for transaction when checking ACK

Federico Cabiddu authored on 09/04/2020 03:11:06 • GitHub committed on 09/04/2020 03:11:06
Showing 1 changed files
... ...
@@ -885,16 +885,18 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t *dst, str *duri,
885 885
 			orig_t = tmb.t_gett();
886 886
 			if(tmb.t_lookup_request(msg,0,&canceled)) {
887 887
 				t_invite = tmb.t_gett();
888
-				if (t_invite->uas.request->msg_flags & FL_SIPTRACE) {
889
-					LM_DBG("Transaction is already been traced, skipping.\n");
890
-					ret = 1;
888
+				if (t_invite!=T_NULL_CELL) {
889
+					if (t_invite->uas.request->msg_flags & FL_SIPTRACE) {
890
+						LM_DBG("Transaction is already been traced, skipping.\n");
891
+						ret = 1;
892
+					}
893
+					tmb.t_release_transaction( t_invite );
894
+					tmb.t_unref(msg);
891 895
 				}
892
-				tmb.t_release_transaction( t_invite );
893
-				tmb.t_unref(msg);
894
-				tmb.t_sett(orig_t, T_BR_UNDEFINED);
895
-				if (ret)
896
-					return 1;
897 896
 			}
897
+			tmb.t_sett(orig_t, T_BR_UNDEFINED);
898
+			if (ret)
899
+				return 1;
898 900
 		}
899 901
 
900 902
 		if (trace_type == SIPTRACE_DIALOG && dlgb.get_dlg == NULL) {