Sfoglia il codice sorgente

core: reset fields from sip_msg_t in shm cloned structure

- instance was pointing to pkg
Daniel-Constantin Mierla 12 anni fa
parent
commit
38157fdbda
3 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 1 0
      parser/msg_parser.c
  2. 2 2
      parser/msg_parser.h
  3. 5 0
      sip_msg_clone.c

+ 1 - 0
parser/msg_parser.c

@@ -726,6 +726,7 @@ void free_sip_msg(struct sip_msg* const msg)
 	if (msg->new_uri.s) { pkg_free(msg->new_uri.s); msg->new_uri.len=0; }
 	if (msg->dst_uri.s) { pkg_free(msg->dst_uri.s); msg->dst_uri.len=0; }
 	if (msg->path_vec.s) { pkg_free(msg->path_vec.s); msg->path_vec.len=0; }
+	reset_instance(msg);
 	if (msg->headers)     free_hdr_field_lst(msg->headers);
 	if (msg->body && msg->body->free) msg->body->free(&msg->body);
 	if (msg->add_rm)      free_lump_list(msg->add_rm);

+ 2 - 2
parser/msg_parser.h

@@ -364,8 +364,8 @@ typedef struct sip_msg {
 	struct socket_info* force_send_socket; /* force sending on this socket,
 											  if ser */
 	str path_vec;
-        str instance;
-        unsigned int reg_id;
+	str instance;
+	unsigned int reg_id;
 } sip_msg_t;
 
 /*! \brief pointer to a fakes message which was never received ;

+ 5 - 0
sip_msg_clone.c

@@ -539,6 +539,11 @@ struct sip_msg*  sip_msg_shm_clone( struct sip_msg *org_msg, int *sip_msg_len,
 	/* path_vec is not cloned (it's reset instead) */
 	new_msg->path_vec.s=0;
 	new_msg->path_vec.len=0;
+	/* instance is not cloned (it's reset instead) */
+	new_msg->instance.s=0;
+	new_msg->instance.len=0;
+	/* reg_id is not cloned (it's reset instead) */
+	new_msg->reg_id=0;
 	/* message buffers(org and scratch pad) */
 	memcpy( p , org_msg->buf, org_msg->len);
 	/* ZT to be safer */