Browse Source

parser/msg_parser: 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 years ago
parent
commit
1ccdadc89c
1 changed files with 3 additions and 7 deletions
  1. 3 7
      parser/msg_parser.c

+ 3 - 7
parser/msg_parser.c

@@ -830,15 +830,11 @@ int set_path_vector(struct sip_msg* msg, str* path)
 void reset_path_vector(struct sip_msg* const msg)
 {
 	/* only free path vector from pkg IFF it is still in pkg... - ie. if msg is shm we don't free... */
-	if (msg->path_vec.s && likely(msg->path_vec.s >= msg->buf && (msg->path_vec.s < (msg->buf + msg->len)))) {
+	if (!(msg->msg_flags&FL_SHM_CLONE)) {
 		pkg_free(msg->path_vec.s);
-	} else {
-		if (msg->path_vec.s)
-			/* don't reset path_vec if it is shm */
-			return;
+		msg->path_vec.s = 0;
+		msg->path_vec.len = 0;
 	}
-	msg->path_vec.s = 0;
-	msg->path_vec.len = 0;
 }