Module: kamailio Branch: master Commit: 55216ee07d5904adc6e9b9750c5b78c9cf100fcf URL: https://github.com/kamailio/kamailio/commit/55216ee07d5904adc6e9b9750c5b78c9cf100fcf
Author: Federico Cabiddu <federico.cabi...@gmail.com> Committer: Federico Cabiddu <federico.cabi...@gmail.com> Date: 2024-11-20T15:31:40+01:00 tsilo: add fixup_free* to exported functions --- Modified: src/modules/tsilo/tsilo.c --- Diff: https://github.com/kamailio/kamailio/commit/55216ee07d5904adc6e9b9750c5b78c9cf100fcf.diff Patch: https://github.com/kamailio/kamailio/commit/55216ee07d5904adc6e9b9750c5b78c9cf100fcf.patch --- diff --git a/src/modules/tsilo/tsilo.c b/src/modules/tsilo/tsilo.c index 719f7cb0f3a..5d290485227 100644 --- a/src/modules/tsilo/tsilo.c +++ b/src/modules/tsilo/tsilo.c @@ -62,14 +62,15 @@ static int w_ts_append_to(struct sip_msg *msg, char *idx, char *lbl, char *d); static int w_ts_append_to2( struct sip_msg *msg, char *idx, char *lbl, char *d, char *ruri); static int fixup_ts_append_to(void **param, int param_no); +static int fixup_free_ts_append_to(void **param, int param_no); static int w_ts_append(struct sip_msg *_msg, char *_table, char *_ruri); static int fixup_ts_append(void **param, int param_no); +static int fixup_free_ts_append(void **param, int param_no); static int w_ts_append_by_contact2( struct sip_msg *_msg, char *_table, char *_ruri); static int w_ts_append_by_contact3( struct sip_msg *_msg, char *_table, char *_ruri, char *_contact); static int w_ts_append_branches(struct sip_msg *_msg, char *_ruri, char *_p2); -static int fixup_ts_append_by_contact(void **param, int param_no); static int w_ts_store(struct sip_msg *msg, char *p1, char *p2); static int w_ts_store1(struct sip_msg *msg, char *_ruri, char *p2); @@ -81,24 +82,23 @@ stat_var *added_branches; /* clang-format off */ static cmd_export_t cmds[] = { - {"ts_append_to", (cmd_function)w_ts_append_to, 3, fixup_ts_append_to, 0, + {"ts_append_to", (cmd_function)w_ts_append_to, 3, fixup_ts_append_to, fixup_free_ts_append_to, REQUEST_ROUTE | FAILURE_ROUTE}, - {"ts_append_to", (cmd_function)w_ts_append_to2, 4, fixup_ts_append_to, - 0, REQUEST_ROUTE | FAILURE_ROUTE}, - {"ts_append", (cmd_function)w_ts_append, 2, fixup_ts_append, 0, + {"ts_append_to", (cmd_function)w_ts_append_to2, 4, fixup_ts_append_to, fixup_free_ts_append_to, REQUEST_ROUTE | FAILURE_ROUTE}, - {"ts_append_by_contact", (cmd_function)w_ts_append_by_contact2, - 2, /* for two parameters */ - fixup_ts_append_by_contact, 0, REQUEST_ROUTE | FAILURE_ROUTE}, - {"ts_append_by_contact", (cmd_function)w_ts_append_by_contact3, - 3, /* for three parameters */ - fixup_ts_append_by_contact, 0, REQUEST_ROUTE | FAILURE_ROUTE}, - {"ts_append_branches", (cmd_function)w_ts_append_branches, 1, - fixup_spve_null, fixup_free_spve_null, + {"ts_append", (cmd_function)w_ts_append, 2, fixup_ts_append, fixup_free_ts_append, + REQUEST_ROUTE | FAILURE_ROUTE}, + {"ts_append_by_contact", (cmd_function)w_ts_append_by_contact2, 2, fixup_ts_append, fixup_free_ts_append, + /* for two parameters */ + REQUEST_ROUTE | FAILURE_ROUTE}, + {"ts_append_by_contact", (cmd_function)w_ts_append_by_contact3, 3,fixup_ts_append, fixup_free_ts_append, + /* for three parameters */ + REQUEST_ROUTE | FAILURE_ROUTE}, + {"ts_append_branches", (cmd_function)w_ts_append_branches, 1, fixup_spve_null, fixup_free_spve_null, REQUEST_ROUTE | FAILURE_ROUTE}, {"ts_store", (cmd_function)w_ts_store, 0, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE}, - {"ts_store", (cmd_function)w_ts_store1, 1, fixup_spve_null, 0, + {"ts_store", (cmd_function)w_ts_store1, 1, fixup_spve_null, fixup_free_spve_null, REQUEST_ROUTE | FAILURE_ROUTE}, {0, 0, 0, 0, 0, 0} }; @@ -239,6 +239,16 @@ static int fixup_ts_append_to(void **param, int param_no) return 0; } +static int fixup_free_ts_append_to(void **param, int param_no) +{ + if(param_no == 1 || param_no == 2) { + fixup_free_igp_null(param, 1); + } else if(param_no == 4) { + fixup_free_spve_null(param, 1); + } + return 0; +} + static int fixup_ts_append(void **param, int param_no) { if(param_no == 1) { @@ -257,19 +267,11 @@ static int fixup_ts_append(void **param, int param_no) return 0; } -static int fixup_ts_append_by_contact(void **param, int param_no) +static int fixup_free_ts_append(void **param, int param_no) { - if(param_no == 1) { - if(strlen((char *)*param) <= 1 - && (*(char *)(*param) == 0 || *(char *)(*param) == '0')) { - *param = (void *)0; - LM_ERR("empty table name\n"); - return -1; - } - } if(param_no == 2 || param_no == 3) { - return fixup_spve_null(param, 1); + fixup_free_spve_null(param, 1); } return 0; _______________________________________________ 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!