Module: sip-router
Branch: 4.0
Commit: 38157fdbdadd1ff2a0ac902088082ad96b0c2f04
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=38157fd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 19 14:06:46 2013 +0200
core: reset fields from sip_msg_t in shm cloned structure
- instance was pointing to pkg
---
parser/msg_parser.c | 1 +
parser/msg_parser.h | 4 ++--
sip_msg_clone.c | 5 +++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/parser/msg_parser.c b/parser/msg_parser.c
index dfed08d..3ea8ad7 100644
--- a/parser/msg_parser.c
+++ b/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);
diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index 2453715..15d557f 100644
--- a/parser/msg_parser.h
+++ b/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 ;
diff --git a/sip_msg_clone.c b/sip_msg_clone.c
index 58ce353..13bc9cd 100644
--- a/sip_msg_clone.c
+++ b/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 */