[sr-dev] [kamailio/kamailio] Remove check for msg->msg_flags inside corex module ?

Lucian Balaceanu lucian.balaceanu at 1and1.ro
Fri Jul 13 12:50:22 CEST 2018


Hi guys,

Seeing the https://github.com/kamailio/kamailio/pull/1144 about fixing a 
memory leak in the tm module due to incorrectly using FL_SHM_CLONE when 
freing path_vec memory, isn't there a case that a similar patch should 
be applied to corex/corex_lib.c ?

Inside corex_append_branch(..) function:

/* 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;
         }

Maybe we should switch to:

         if(msg->path_vec.s!=0)
             pkg_free(msg->path_vec.s);
         msg->path_vec.s = 0;
         msg->path_vec.len = 0;

If you agree this is the case, I will  prepare a pull request.

Thank you,
Lucian



More information about the sr-dev mailing list