Browse Source

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
Daniel-Constantin Mierla 9 years ago
parent
commit
16bc7b726a
3 changed files with 3 additions and 16 deletions
  1. 2 14
      modules/dmq/dmqnode.c
  2. 0 1
      modules/dmq/dmqnode.h
  3. 1 1
      modules/dmq/notification_peer.c

+ 2 - 14
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);
 	}
 }

+ 0 - 1
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 */

+ 1 - 1
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;