2
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
99d50e2da0

+ 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);
 			pkg_free(msg->dst_uri.s);
 		msg->dst_uri.s = 0;
 		msg->dst_uri.s = 0;
 		msg->dst_uri.len = 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);
 				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;
 	return ret;