Ver código fonte

tm: prper timer cleanup of responses for rpc tm.t_uac_wait_block

Daniel-Constantin Mierla 4 anos atrás
pai
commit
5a6a679985
1 arquivos alterados com 5 adições e 3 exclusões
  1. 5 3
      src/modules/tm/rpc_uac.c

+ 5 - 3
src/modules/tm/rpc_uac.c

@@ -204,14 +204,16 @@ void tm_rpc_response_list_clean(unsigned int ticks, void *param)
 	ri1 = _tm_rpc_response_list->rlist;
 	ri1 = _tm_rpc_response_list->rlist;
 	while(ri1!=NULL) {
 	while(ri1!=NULL) {
 		if(ri1->rtime < tnow - TM_RPC_RESPONSE_LIFETIME) {
 		if(ri1->rtime < tnow - TM_RPC_RESPONSE_LIFETIME) {
+			LM_DBG("freeing item [%.*s]\n", ri1->ruid.len, ri1->ruid.s);
 			if(ri0 == NULL) {
 			if(ri0 == NULL) {
 				_tm_rpc_response_list->rlist = ri1->next;
 				_tm_rpc_response_list->rlist = ri1->next;
+				shm_free(ri1);
+				ri1 = _tm_rpc_response_list->rlist;
 			} else {
 			} else {
 				ri0->next = ri1->next;
 				ri0->next = ri1->next;
+				shm_free(ri1);
+				ri1 = ri0->next;
 			}
 			}
-			LM_DBG("freeing item [%.*s]\n", ri1->ruid.len, ri1->ruid.s);
-			shm_free(ri1);
-			ri1 = ri0->next;
 		} else {
 		} else {
 			ri0 = ri1;
 			ri0 = ri1;
 			ri1 = ri1->next;
 			ri1 = ri1->next;