Module: kamailio Branch: master Commit: c45c71164ed40e06cdfab4ceda292d29d2d1459f URL: https://github.com/kamailio/kamailio/commit/c45c71164ed40e06cdfab4ceda292d29d2d1459f
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2025-02-11T15:23:34+01:00 lib/ims: renamed specific macros with pretty generic name --- Modified: src/lib/ims/ims_getters.c Modified: src/lib/ims/ims_getters.h --- Diff: https://github.com/kamailio/kamailio/commit/c45c71164ed40e06cdfab4ceda292d29d2d1459f.diff Patch: https://github.com/kamailio/kamailio/commit/c45c71164ed40e06cdfab4ceda292d29d2d1459f.patch --- diff --git a/src/lib/ims/ims_getters.c b/src/lib/ims/ims_getters.c index 44f1a0be34d..8d97a7a54f9 100644 --- a/src/lib/ims/ims_getters.c +++ b/src/lib/ims/ims_getters.c @@ -1303,20 +1303,21 @@ int cscf_get_p_charging_vector( if(!header->body.s || !header->body.len) return 0; - str_dup(header_body, header->body, pkg); + ims_str_dup(header_body, header->body, pkg); LM_DBG("p_charging_vector body is %.*s\n", header_body.len, header_body.s); p = strtok(header_body.s, " ;:\r\t\n\"="); loop: - if(p == NULL || p > (header_body.s + header_body.len)) + if(p == NULL || p > (header_body.s + header_body.len)) { return 1; + } if(strncmp(p, "icid-value", 10) == 0) { p = strtok(NULL, " ;:\r\t\n\"="); if(p == NULL || p > (header_body.s + header_body.len)) { LM_ERR("cscf_get_p_charging_vector: no value for icid\n"); - return 0; + goto error; } temp.s = p; temp.len = 0; @@ -1332,11 +1333,10 @@ int cscf_get_p_charging_vector( p = strtok(NULL, " ;:\r\t\n\"="); goto loop; } else if(strncmp(p, "orig-ioi", 8) == 0) { - p = strtok(NULL, " ;:\r\t\n\"="); if(p == NULL || p > (header_body.s + header_body.len)) { LM_ERR("cscf_get_p_charging_vector: no value for icid\n"); - return 0; + goto error; } temp.s = p; temp.len = 0; @@ -1352,11 +1352,10 @@ int cscf_get_p_charging_vector( p = strtok(NULL, " ;:\r\t\n\"="); goto loop; } else if(strncmp(p, "term-ioi", 8) == 0) { - p = strtok(NULL, " ;:\r\t\n\"="); if(p == NULL || p > (header_body.s + header_body.len)) { LM_ERR("cscf_get_p_charging_vector: no value for icid\n"); - return 0; + goto error; } temp.s = p; temp.len = 0; @@ -1374,10 +1373,12 @@ int cscf_get_p_charging_vector( } LM_DBG("end\n"); - str_free(header_body, pkg); + ims_str_free(header_body, pkg); return 1; out_of_memory: PKG_MEM_ERROR; +error: + ims_str_free(header_body, pkg); return 0; } diff --git a/src/lib/ims/ims_getters.h b/src/lib/ims/ims_getters.h index 081a5ae1934..4d10c00077d 100644 --- a/src/lib/ims/ims_getters.h +++ b/src/lib/ims/ims_getters.h @@ -80,7 +80,7 @@ enum cscf_dialog_direction * @param src - source src * @param mem - type of mem to duplicate into (shm/pkg) */ -#define str_dup(dst, src, mem) \ +#define ims_str_dup(dst, src, mem) \ do { \ if((src).len) { \ (dst).s = mem##_malloc((src).len); \ @@ -102,7 +102,7 @@ enum cscf_dialog_direction * @param x - the str to free * @param mem - type of memory that the content is using (shm/pkg) */ -#define str_free(x, mem) \ +#define ims_str_free(x, mem) \ do { \ if((x).s) \ mem##_free((x).s); \ _______________________________________________ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!