Module: kamailio Branch: master Commit: 71d65437e3eda77075d0dac38d8257f1a4dba97e URL: https://github.com/kamailio/kamailio/commit/71d65437e3eda77075d0dac38d8257f1...
Author: jaybeepee jason.penton@gmail.com Committer: jaybeepee jason.penton@gmail.com Date: 2015-04-16T16:58:23+02:00
modules/ims_qos: release dialog after referencing it in lookup
---
Modified: modules/ims_qos/mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/71d65437e3eda77075d0dac38d8257f1... Patch: https://github.com/kamailio/kamailio/commit/71d65437e3eda77075d0dac38d8257f1...
---
diff --git a/modules/ims_qos/mod.c b/modules/ims_qos/mod.c index f9fbc2d..a59caa4 100644 --- a/modules/ims_qos/mod.c +++ b/modules/ims_qos/mod.c @@ -529,6 +529,10 @@ void callback_pcscf_contact_cb(struct pcontact *c, int type, void *param) { static int get_identifier(str* src) { char *sep;
+ if (src == 0 || src->len == 0){ + return -1; + } + if (identifier_size <= src->len) { if (identifier.s) { pkg_free(identifier.s); @@ -572,7 +576,6 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int str ip, uri; int identifier_type; int ip_version = 0; - int must_free_asserted_identity = 0; sdp_session_cell_t* sdp_session; str s_id; struct hdr_field *h=0; @@ -760,7 +763,8 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int } else { get_identifier(&uri); - must_free_asserted_identity = 1; + //free this cscf_get_asserted_identity allocates it + pkg_free(uri.s); } } else { LM_DBG("terminating direction\n"); @@ -843,12 +847,6 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int goto error; } - //free this cscf_get_asserted_identity allocates it - if (must_free_asserted_identity) { - pkg_free(identifier.s); - must_free_asserted_identity = 1; - } - //create new diameter auth session auth_session = cdpb.AAACreateClientAuthSession(1, callback_for_cdp_session, rx_authdata_p); //returns with a lock if (!auth_session) { @@ -901,13 +899,6 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int if (saved_t_data) free_saved_transaction_global_data(saved_t_data); //only free global data if no AARs were sent. if one was sent we have to rely on the callback (CDP) to free //otherwise the callback will segfault - - //free this cscf_get_asserted_identity allocates it - if (must_free_asserted_identity) { - pkg_free(identifier.s); - must_free_asserted_identity = 1; - } - return result; }