浏览代码

modules/corex: corrected freeing of msg. w.r.t path vecor
- now use FL_SHM_CLONE internal msg flag to decide whether or not to pkg free path_vec

Jason Penton 11 年之前
父节点
当前提交
99d50e2da0
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      modules/corex/corex_lib.c

+ 7 - 4
modules/corex/corex_lib.c

@@ -83,11 +83,14 @@ int corex_append_branch(sip_msg_t *msg, gparam_t *pu, gparam_t *pq)
 			pkg_free(msg->dst_uri.s);
 		msg->dst_uri.s = 0;
 		msg->dst_uri.len = 0;
-		if(msg->path_vec.s!=0)
-			if (likely(msg->path_vec.s >= msg->buf && (msg->path_vec.s < (msg->buf + msg->len))))
+
+		/* if this is a cloned message, don't free the path vector as it was copied into shm memory and will be freed as contiguous block*/
+		if (!(msg->msg_flags&FL_SHM_CLONE)) {
+			if(msg->path_vec.s!=0)
 				pkg_free(msg->path_vec.s);
-		msg->path_vec.s = 0;
-		msg->path_vec.len = 0;
+			msg->path_vec.s = 0;
+			msg->path_vec.len = 0;
+		}
 	}
 
 	return ret;