Browse code

fixed deadlock caused by broken From

Jiri Kuthan authored on 30/04/2003 01:09:19
Showing 1 changed files
... ...
@@ -936,7 +936,7 @@ int init_rb( struct retr_buf *rb, struct sip_msg *msg)
936 936
 int t_newtran( struct sip_msg* p_msg )
937 937
 {
938 938
 
939
-	int ret, lret;
939
+	int ret, lret, my_err;
940 940
 	struct cell *new_cell;
941 941
 	struct sip_msg *shm_msg;
942 942
 
... ...
@@ -988,21 +988,24 @@ int t_newtran( struct sip_msg* p_msg )
988 988
 			if (p_msg->REQ_METHOD==METHOD_INVITE) {
989 989
 				if (parse_from_header(p_msg)<0) {
990 990
 					LOG(L_ERR, "ERROR: t_newtran: no valid From\n");
991
-					return E_BAD_REQ;
991
+					my_err=E_BAD_REQ;
992
+					goto new_err;
992 993
 				}
993 994
 			}
994 995
 			/* REVIEW */
995 996
 			/* make sure uri will be parsed before cloning */
996 997
 			if (parse_sip_msg_uri(p_msg)<0) {
997 998
 				LOG(L_ERR, "ERROR: t_new_tran: uri invalid\n");
998
-				return E_BAD_REQ;
999
+				my_err=E_BAD_REQ;
1000
+				goto new_err;
999 1001
 			}
1000 1002
 			
1001 1003
 			/* add new transaction */
1002 1004
 			new_cell = build_cell( p_msg ) ;
1003 1005
 			if  ( !new_cell ){
1004 1006
 				LOG(L_ERR, "ERROR: t_addifnew: out of mem:\n");
1005
-				ret = E_OUT_OF_MEM;
1007
+				my_err = E_OUT_OF_MEM;
1008
+				goto new_err;
1006 1009
 			} else {
1007 1010
 				insert_into_hash_table_unsafe( new_cell );
1008 1011
 				set_t(new_cell);
... ...
@@ -1085,6 +1088,10 @@ int t_newtran( struct sip_msg* p_msg )
1085 1085
 	/* things are done -- return from script */
1086 1086
 	return 0;
1087 1087
 
1088
+new_err:
1089
+	UNLOCK_HASH(p_msg->hash_index);
1090
+	return my_err;
1091
+
1088 1092
 }
1089 1093
 
1090 1094