[sr-dev] git:master:16bc7b72: dmq: removed params field from dmq_node_t

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 17 22:57:21 CET 2015


Module: kamailio
Branch: master
Commit: 16bc7b726a21108458f354aea840cdbf5d89d6d8
URL: https://github.com/kamailio/kamailio/commit/16bc7b726a21108458f354aea840cdbf5d89d6d8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-11-17T22:51:01+01:00

dmq: removed params field from dmq_node_t

- used only for setting a flag
- duplicating a node caused issues with param field not being
  duplicated, resulting in potential many free of same pointer, reported
  by Sebastian Damm

---

Modified: modules/dmq/dmqnode.c
Modified: modules/dmq/dmqnode.h
Modified: modules/dmq/notification_peer.c

---

Diff:  https://github.com/kamailio/kamailio/commit/16bc7b726a21108458f354aea840cdbf5d89d6d8.diff
Patch: https://github.com/kamailio/kamailio/commit/16bc7b726a21108458f354aea840cdbf5d89d6d8.patch

---

diff --git a/modules/dmq/dmqnode.c b/modules/dmq/dmqnode.c
index 7b0bf63..f9816cb 100644
--- a/modules/dmq/dmqnode.c
+++ b/modules/dmq/dmqnode.c
@@ -185,20 +185,12 @@ dmq_node_t* build_dmq_node(str* uri, int shm) {
 	}
 	/* if any params found */
 	if(params) {
-		if(shm) {
-			if(shm_duplicate_params(&ret->params, params) < 0) {
-				LM_ERR("error duplicating params\n");
-				free_params(params);
-				goto error;
-			}
+		if(set_dmq_node_params(ret, params) < 0) {
 			free_params(params);
-		} else {
-			ret->params = params;
-		}
-		if(set_dmq_node_params(ret, ret->params) < 0) {
 			LM_ERR("error setting parameters\n");
 			goto error;
 		}
+		free_params(params);
 	} else {
 		LM_DBG("no dmqnode params found\n");		
 	}
@@ -248,12 +240,8 @@ dmq_node_t* find_dmq_node_uri2(str* uri)
 void destroy_dmq_node(dmq_node_t* node, int shm)
 {
 	if(shm) {
-		if (node->params!=NULL)
-			shm_free_params(node->params);
 		shm_free_node(node);
 	} else {
-		if (node->params!=NULL)
-			free_params(node->params);
 		pkg_free_node(node);
 	}
 }
diff --git a/modules/dmq/dmqnode.h b/modules/dmq/dmqnode.h
index 2ef7b5f..7bc7ff6 100644
--- a/modules/dmq/dmqnode.h
+++ b/modules/dmq/dmqnode.h
@@ -43,7 +43,6 @@ typedef struct dmq_node {
 	str orig_uri; /* original uri string - e.g. sip:127.0.0.1:5060;passive=true */
 	struct sip_uri uri; /* parsed uri string */
 	struct ip_addr ip_address; /* resolved IP address */
-	param_t* params; /* uri parameters */
 	int status; /* reserved - maybe something like active,timeout,disabled */
 	int last_notification; /* last notificatino receied from the node */
 	struct dmq_node* next; /* pointer to the next struct dmq_node */
diff --git a/modules/dmq/notification_peer.c b/modules/dmq/notification_peer.c
index 3abefde..3bcff96 100644
--- a/modules/dmq/notification_peer.c
+++ b/modules/dmq/notification_peer.c
@@ -406,7 +406,7 @@ int extract_node_list(dmq_node_list_t* update_list, struct sip_msg* msg)
 			update_list->nodes = cur;
 			update_list->count++;
 			total_nodes++;
-		} else if (find->params && ret->status != find->status) {
+		} else if (find->uri.params.s && ret->status != find->status) {
 			LM_DBG("updating status on %.*s from %d to %d\n",
 				STR_FMT(&tmp_uri), ret->status, find->status);
 			ret->status = find->status;




More information about the sr-dev mailing list