kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
February 2025
----- 2025 -----
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
9 participants
171 discussions
Start a n
N
ew thread
git:master:b875e736: pv: free next field on error when parsing xav* names
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: b875e7368dcc8e221007caafa3599c3e354404f7 URL:
https://github.com/kamailio/kamailio/commit/b875e7368dcc8e221007caafa3599c3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T11:45:06+01:00 pv: free next field on error when parsing xav* names --- Modified: src/modules/pv/pv_xavp.c --- Diff:
https://github.com/kamailio/kamailio/commit/b875e7368dcc8e221007caafa3599c3…
Patch:
https://github.com/kamailio/kamailio/commit/b875e7368dcc8e221007caafa3599c3…
--- diff --git a/src/modules/pv/pv_xavp.c b/src/modules/pv/pv_xavp.c index 89d9ba131d0..8858c376367 100644 --- a/src/modules/pv/pv_xavp.c +++ b/src/modules/pv/pv_xavp.c @@ -516,6 +516,10 @@ int pv_parse_xavp_name(pv_spec_p sp, str *in) error: if(xname != NULL) { + if(xname->next != NULL) { + pkg_free(xname->next); + xname->next = NULL; + } pv_xavp_name_destroy(xname); pkg_free(xname); } @@ -964,6 +968,10 @@ int pv_parse_xavu_name(pv_spec_t *sp, str *in) error: if(xname != NULL) { + if(xname->next != NULL) { + pkg_free(xname->next); + xname->next = NULL; + } pv_xavu_name_destroy(xname); pkg_free(xname); } @@ -1111,6 +1119,10 @@ int pv_parse_xavi_name(pv_spec_p sp, str *in) error: if(xname != NULL) { + if(xname->next != NULL) { + pkg_free(xname->next); + xname->next = NULL; + } pv_xavi_name_destroy(xname); pkg_free(xname); }
1
0
0
0
git:master:d0cd3c4b: topoh: check on pointer only for via decode return
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: d0cd3c4b40fd791143122622a6d74703e1375832 URL:
https://github.com/kamailio/kamailio/commit/d0cd3c4b40fd791143122622a6d7470…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T11:01:20+01:00 topoh: check on pointer only for via decode return - code reformatted --- Modified: src/modules/topoh/th_msg.c --- Diff:
https://github.com/kamailio/kamailio/commit/d0cd3c4b40fd791143122622a6d7470…
Patch:
https://github.com/kamailio/kamailio/commit/d0cd3c4b40fd791143122622a6d7470…
--- diff --git a/src/modules/topoh/th_msg.c b/src/modules/topoh/th_msg.c index 1984875e0c6..54d3caffe62 100644 --- a/src/modules/topoh/th_msg.c +++ b/src/modules/topoh/th_msg.c @@ -177,10 +177,8 @@ int th_mask_via(sip_msg_t *msg, str *via_prefix) vlen = th_skip_rw(via->name.s, via->bsize); LM_DBG("body: %d: [%.*s]\n", vlen, vlen, via->name.s); if(i != 1) { - out.s = th_mask_encode( - via->name.s, vlen, via_prefix, &out.len); - if(out.s == NULL) - { + out.s = th_mask_encode(via->name.s, vlen, via_prefix, &out.len); + if(out.s == NULL) { LM_ERR("cannot encode via %d\n", i); return -1; } @@ -372,11 +370,11 @@ int th_unmask_via(sip_msg_t *msg, str *ip, str *cookie) LM_DBG("body: %d: [%.*s]\n", vlen, vlen, via->name.s); if(i != 1) { /* Skip if via is not encoded */ - if (th_uri_prefix_checks - && (via->host.len != ip->len - || strncasecmp(via->host.s, ip->s, ip->len) - != 0)) { - LM_DBG("via %d is not encoded - skip\n",i); + if(th_uri_prefix_checks + && (via->host.len != ip->len + || strncasecmp(via->host.s, ip->s, ip->len) + != 0)) { + LM_DBG("via %d is not encoded - skip\n", i); continue; } @@ -404,7 +402,7 @@ int th_unmask_via(sip_msg_t *msg, str *ip, str *cookie) out.s = th_mask_decode(vp->value.s, vp->value.len, &th_vparam_prefix, 0, &out.len); } - if(out.s == NULL || out.len <= 0) { + if(out.s == NULL) { LM_ERR("cannot decode via %d\n", i); return -1; } @@ -599,7 +597,7 @@ int th_flip_record_route(sip_msg_t *msg, str *uri_prefix, str *ip, int mode) case 1: /* encode */ if(act != 0 && mode == 1) { out.s = th_mask_encode(rr->nameaddr.uri.s, - rr->nameaddr.uri.len, uri_prefix, &out.len); + rr->nameaddr.uri.len, uri_prefix, &out.len); if(out.s == NULL) { LM_ERR("cannot encode r-r %d\n", i); return -1; @@ -665,10 +663,10 @@ int th_unmask_route(sip_msg_t *msg, str *uri_prefix) i++; if(i != 1) { /* Skip if route is not encoded */ - if (th_uri_prefix_checks - && ((rr->nameaddr.uri.len<uri_prefix->len) - || (strncasecmp(rr->nameaddr.uri.s, - uri_prefix->s, uri_prefix->len) + if(th_uri_prefix_checks + && ((rr->nameaddr.uri.len < uri_prefix->len) + || (strncasecmp(rr->nameaddr.uri.s, + uri_prefix->s, uri_prefix->len) != 0))) { LM_DBG("rr %d is not encoded: [%.*s] - missing prefix\n", i, rr->nameaddr.uri.len, rr->nameaddr.uri.s); @@ -721,12 +719,12 @@ int th_unmask_ruri(sip_msg_t *msg, str *uri_prefix) str out; /* Do nothing if ruri is not encoded */ - if (th_uri_prefix_checks - && ((REQ_LINE(msg).uri.len<uri_prefix->len) + if(th_uri_prefix_checks + && ((REQ_LINE(msg).uri.len < uri_prefix->len) || (strncasecmp(REQ_LINE(msg).uri.s, uri_prefix->s, uri_prefix->len) != 0))) { - LM_DBG("ruri [%.*s] is not encoded",REQ_LINE(msg).uri.len, + LM_DBG("ruri [%.*s] is not encoded", REQ_LINE(msg).uri.len, REQ_LINE(msg).uri.s); return 0; } @@ -784,11 +782,11 @@ int th_unmask_refer_to(sip_msg_t *msg, str *uri_prefix) uri = &(get_refer_to(msg)->uri); /* Do nothing if refer_to is not encoded */ - if (th_uri_prefix_checks - && ((uri->len<uri_prefix->len) + if(th_uri_prefix_checks + && ((uri->len < uri_prefix->len) || (strncasecmp(uri->s, uri_prefix->s, uri_prefix->len) != 0))) { - LM_DBG("refer-to [%.*s] is not encoded",uri->len,uri->s); + LM_DBG("refer-to [%.*s] is not encoded", uri->len, uri->s); return 0; }
1
0
0
0
git:master:aa081dbd: tm: rpc uac - jump to error when failing to create delayed context
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: aa081dbd1ee1901c6174ffddd556bda47b6ef732 URL:
https://github.com/kamailio/kamailio/commit/aa081dbd1ee1901c6174ffddd556bda…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T10:50:32+01:00 tm: rpc uac - jump to error when failing to create delayed context --- Modified: src/modules/tm/rpc_uac.c --- Diff:
https://github.com/kamailio/kamailio/commit/aa081dbd1ee1901c6174ffddd556bda…
Patch:
https://github.com/kamailio/kamailio/commit/aa081dbd1ee1901c6174ffddd556bda…
--- diff --git a/src/modules/tm/rpc_uac.c b/src/modules/tm/rpc_uac.c index e63da4fb835..2d7bd6113d4 100644 --- a/src/modules/tm/rpc_uac.c +++ b/src/modules/tm/rpc_uac.c @@ -778,7 +778,7 @@ static void rpc_t_uac(rpc_t *rpc, void *c, int reply_wait) dctx = rpc->delayed_ctx_new(c); if(dctx == 0) { rpc->fault(c, 500, "internal error: failed to create context"); - return; + goto error01; } uac_req.cb = rpc_uac_callback; uac_req.cbp = dctx;
1
0
0
0
git:master:27e1e910: tm: jump to error when failing to built content length for uac cancel
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: 27e1e9102f07047a3d2c2f28baa708f14be556a6 URL:
https://github.com/kamailio/kamailio/commit/27e1e9102f07047a3d2c2f28baa708f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T10:42:27+01:00 tm: jump to error when failing to built content length for uac cancel --- Modified: src/modules/tm/t_msgbuilder.c --- Diff:
https://github.com/kamailio/kamailio/commit/27e1e9102f07047a3d2c2f28baa708f…
Patch:
https://github.com/kamailio/kamailio/commit/27e1e9102f07047a3d2c2f28baa708f…
--- diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c index 71fd4e644b3..d9231486c61 100644 --- a/src/modules/tm/t_msgbuilder.c +++ b/src/modules/tm/t_msgbuilder.c @@ -1827,7 +1827,8 @@ char *build_uac_cancel(str *headers, str *body, struct cell *cancelledT, char branch_buf[MAX_BRANCH_PARAM_LEN]; str branch_str; struct hostport hp; - str content_length, via; + str content_length; + str via = STR_NULL; LM_DBG("sing FROM=<%.*s>, TO=<%.*s>, CSEQ_N=<%.*s>\n", cancelledT->from_hdr.len, cancelledT->from_hdr.s, @@ -1866,7 +1867,7 @@ char *build_uac_cancel(str *headers, str *body, struct cell *cancelledT, /* Content Length */ if(print_content_length(&content_length, body) < 0) { LM_ERR("failed to print content-length\n"); - return 0; + goto error01; } /* Content-Length */ *len += (body ? (CONTENT_LENGTH_LEN + content_length.len + CRLF_LEN) : 0);
1
0
0
0
git:master:e85d07e5: tm: split reverse rte list function
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: e85d07e5b42ff25f81b74f68ab412e0ab27e7170 URL:
https://github.com/kamailio/kamailio/commit/e85d07e5b42ff25f81b74f68ab412e0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T10:32:51+01:00 tm: split reverse rte list function --- Modified: src/modules/tm/t_msgbuilder.c --- Diff:
https://github.com/kamailio/kamailio/commit/e85d07e5b42ff25f81b74f68ab412e0…
Patch:
https://github.com/kamailio/kamailio/commit/e85d07e5b42ff25f81b74f68ab412e0…
--- diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c index b2c101bf2b6..71fd4e644b3 100644 --- a/src/modules/tm/t_msgbuilder.c +++ b/src/modules/tm/t_msgbuilder.c @@ -750,6 +750,26 @@ static inline int get_contact_uri(struct sip_msg *msg, str *uri) return 0; } +/** + * reverse rte list + */ +static inline rte_t *tm_reverse_rte_list(rte_t *head) +{ + rte_t *prev = NULL; + rte_t *current = NULL; + rte_t *next = NULL; + + current = head; + while(current != NULL) { + next = current->next; + current->next = prev; + prev = current; + current = next; + } + + return prev; +} + /** * Extract route set from the message (out of Record-Route, if reply, OR * Route, if request). @@ -760,7 +780,7 @@ static inline int get_uac_rs(sip_msg_t *msg, int is_req, struct rte **rtset) { struct hdr_field *ptr; rr_t *p, *new_p; - struct rte *t, *head, *old_head; + struct rte *t, *head; head = 0; for(ptr = is_req ? msg->route : msg->record_route; ptr; ptr = ptr->next) { @@ -810,14 +830,7 @@ static inline int get_uac_rs(sip_msg_t *msg, int is_req, struct rte **rtset) if(is_req) { /* harvesting the R/RR HF above inserts at head, which suites RRs (as * they must be reversed, anyway), but not Rs => reverse once more */ - old_head = head; - head = 0; - while(old_head) { - t = old_head; - old_head = old_head->next; - t->next = head; - head = t; - } + head = tm_reverse_rte_list(head); } *rtset = head; @@ -827,7 +840,6 @@ static inline int get_uac_rs(sip_msg_t *msg, int is_req, struct rte **rtset) return -1; } - static inline unsigned short uri2port(const struct sip_uri *puri) { if(puri->port.s) {
1
0
0
0
git:master:7c908137: xprint: break on first resolved ip address
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: 7c908137826071b8180bd93ff8ba3994be66da3a URL:
https://github.com/kamailio/kamailio/commit/7c908137826071b8180bd93ff8ba399…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T09:48:33+01:00 xprint: break on first resolved ip address --- Modified: src/modules/xprint/xp_lib.c --- Diff:
https://github.com/kamailio/kamailio/commit/7c908137826071b8180bd93ff8ba399…
Patch:
https://github.com/kamailio/kamailio/commit/7c908137826071b8180bd93ff8ba399…
--- diff --git a/src/modules/xprint/xp_lib.c b/src/modules/xprint/xp_lib.c index 567e62ade86..cdcde6807d2 100644 --- a/src/modules/xprint/xp_lib.c +++ b/src/modules/xprint/xp_lib.c @@ -1888,6 +1888,7 @@ int xl_mod_init() if(str_ipaddr.s) { memcpy(str_ipaddr.s, s, str_ipaddr.len); str_ipaddr.s[str_ipaddr.len] = '\0'; + break; } else { pkg_free(s); s = NULL;
1
0
0
0
git:master:4c4d7f79: ctl: fifo - clean intermediary buffer
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: 4c4d7f7967a99d4dd4acdc5e198bce493bf15d67 URL:
https://github.com/kamailio/kamailio/commit/4c4d7f7967a99d4dd4acdc5e198bce4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T09:43:43+01:00 ctl: fifo - clean intermediary buffer --- Modified: src/modules/ctl/fifo_server.c --- Diff:
https://github.com/kamailio/kamailio/commit/4c4d7f7967a99d4dd4acdc5e198bce4…
Patch:
https://github.com/kamailio/kamailio/commit/4c4d7f7967a99d4dd4acdc5e198bce4…
--- diff --git a/src/modules/ctl/fifo_server.c b/src/modules/ctl/fifo_server.c index 197302c1771..70ce92deb76 100644 --- a/src/modules/ctl/fifo_server.c +++ b/src/modules/ctl/fifo_server.c @@ -1261,7 +1261,7 @@ static int rpc_add(rpc_ctx_t *ctx, char *fmt, ...) static int rpc_struct_printf(struct text_chunk *c, char *name, char *fmt, ...) { int n, buf_size; - char *buf; + char *buf = NULL; char *buf0; va_list ap; str s, nm; @@ -1314,6 +1314,7 @@ static int rpc_struct_printf(struct text_chunk *c, char *name, char *fmt, ...) c->next = m; if(c == ctx->last) ctx->last = m; + ctl_free(buf); return 0; } /* Else try again with more space. */ @@ -1329,6 +1330,7 @@ static int rpc_struct_printf(struct text_chunk *c, char *name, char *fmt, ...) } buf = buf0; } + ctl_free(buf); return 0; err: if(buf)
1
0
0
0
git:master:ff712539: xmlrpc: clean allocated buffer
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: ff712539566c903312ebba2f8e2585f9c80ffdcf URL:
https://github.com/kamailio/kamailio/commit/ff712539566c903312ebba2f8e2585f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T09:40:00+01:00 xmlrpc: clean allocated buffer --- Modified: src/modules/xmlrpc/xmlrpc.c --- Diff:
https://github.com/kamailio/kamailio/commit/ff712539566c903312ebba2f8e2585f…
Patch:
https://github.com/kamailio/kamailio/commit/ff712539566c903312ebba2f8e2585f…
--- diff --git a/src/modules/xmlrpc/xmlrpc.c b/src/modules/xmlrpc/xmlrpc.c index 4157e94904d..eb44f4450dd 100644 --- a/src/modules/xmlrpc/xmlrpc.c +++ b/src/modules/xmlrpc/xmlrpc.c @@ -2024,7 +2024,7 @@ static int rpc_struct_printf( struct rpc_struct *s, char *member_name, char *fmt, ...) { int n, buf_size; - char *buf; + char *buf = NULL; va_list ap; str st, name; struct xmlrpc_reply *reply; @@ -2076,6 +2076,7 @@ static int rpc_struct_printf( if(add_xmlrpc_reply(out, &member_suffix) < 0) goto err; + mxr_free(buf); return 0; } /* Else try again with more space. */ @@ -2090,6 +2091,8 @@ static int rpc_struct_printf( goto err; } } + if(buf) + mxr_free(buf); return 0; err: if(buf) @@ -2745,7 +2748,7 @@ static int ki_xmlrpc_reply(sip_msg_t *msg, int rcode, str *reason) if(add_xmlrpc_reply(&reply, &int_suffix) < 0) goto error; if(add_xmlrpc_reply(&reply, &success_suffix) < 0) - return -1; + goto error; } if(send_reply(msg, &reply.body) < 0) goto error;
1
0
0
0
git:master:b17038ec: xprint: init globals when declared
by Daniel-Constantin Mierla
13 Feb '25
13 Feb '25
Module: kamailio Branch: master Commit: b17038ec072b1854fa2fae1c2d4725c1471ef8ac URL:
https://github.com/kamailio/kamailio/commit/b17038ec072b1854fa2fae1c2d4725c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-13T09:18:00+01:00 xprint: init globals when declared --- Modified: src/modules/xprint/xp_lib.c --- Diff:
https://github.com/kamailio/kamailio/commit/b17038ec072b1854fa2fae1c2d4725c…
Patch:
https://github.com/kamailio/kamailio/commit/b17038ec072b1854fa2fae1c2d4725c…
--- diff --git a/src/modules/xprint/xp_lib.c b/src/modules/xprint/xp_lib.c index fda12a82fc3..567e62ade86 100644 --- a/src/modules/xprint/xp_lib.c +++ b/src/modules/xprint/xp_lib.c @@ -56,7 +56,10 @@ static str str_null = STR_STATIC_INIT("<null>"); static str str_empty = STR_STATIC_INIT(""); static str str_per = STR_STATIC_INIT("%"); -static str str_hostname, str_domainname, str_fullname, str_ipaddr; +static str str_hostname = STR_NULL; +static str str_domainname = STR_NULL; +static str str_fullname = STR_NULL; +static str str_ipaddr = STR_NULL; enum xl_host_t { @@ -1835,14 +1838,7 @@ int xl_mod_init() PKG_MEM_ERROR; return -1; } - if(gethostname(s, HOSTNAME_MAX) < 0) { - str_fullname.len = 0; - str_fullname.s = NULL; - str_hostname.len = 0; - str_hostname.s = NULL; - str_domainname.len = 0; - str_domainname.s = NULL; - } else { + if(gethostname(s, HOSTNAME_MAX) >= 0) { str_fullname.len = strlen(s); s = pkg_reallocxf( s, str_fullname.len + 1); /* this will leave the ending \0 */ @@ -1870,8 +1866,6 @@ int xl_mod_init() } } - str_ipaddr.len = 0; - str_ipaddr.s = NULL; if(str_fullname.len) { he = resolvehost(str_fullname.s); if(he) {
1
0
0
0
git:master:4a71d3c9: ctl: free rpc struct in case of error
by Daniel-Constantin Mierla
12 Feb '25
12 Feb '25
Module: kamailio Branch: master Commit: 4a71d3c9e6a4f92ef33ce8e62372b2c4dba62a56 URL:
https://github.com/kamailio/kamailio/commit/4a71d3c9e6a4f92ef33ce8e62372b2c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2025-02-12T17:48:42+01:00 ctl: free rpc struct in case of error --- Modified: src/modules/ctl/binrpc_run.c --- Diff:
https://github.com/kamailio/kamailio/commit/4a71d3c9e6a4f92ef33ce8e62372b2c…
Patch:
https://github.com/kamailio/kamailio/commit/4a71d3c9e6a4f92ef33ce8e62372b2c…
--- diff --git a/src/modules/ctl/binrpc_run.c b/src/modules/ctl/binrpc_run.c index 1a9eb27bd79..cb1220b5c87 100644 --- a/src/modules/ctl/binrpc_run.c +++ b/src/modules/ctl/binrpc_run.c @@ -1027,7 +1027,7 @@ static int rpc_add(struct binrpc_ctx *ctx, char *fmt, ...) int err; str st; str *sp; - struct rpc_struct_l *rs; + struct rpc_struct_l *rs = NULL; str null_value = str_init("<null string>"); double d; @@ -1071,12 +1071,14 @@ static int rpc_add(struct binrpc_ctx *ctx, char *fmt, ...) if(err < 0) goto error_add; rs = new_rpc_struct(); - if(rs == 0) + if(rs == NULL) goto error_mem; rs->offset = binrpc_pkt_len(&ctx->out.pkt); err = binrpc_end_struct(&ctx->out.pkt); - if(err < 0) + if(err < 0) { + ctl_free(rs); goto error_add; + } clist_append(&ctx->out.structs, rs, next, prev); *(va_arg(ap, void **)) = rs; break; @@ -1182,7 +1184,7 @@ static int rpc_struct_add(struct rpc_struct_l *s, char *fmt, ...) va_list ap; int err; struct binrpc_val avp; - struct rpc_struct_l *rs; + struct rpc_struct_l *rs = NULL; str *sp; str null_value = str_init("<null string>"); @@ -1228,7 +1230,7 @@ static int rpc_struct_add(struct rpc_struct_l *s, char *fmt, ...) goto error_add; } rs = new_rpc_struct(); - if(rs == 0) { + if(rs == NULL) { LM_ERR("not enough memory (%c)\n", *fmt); goto error_mem; } @@ -1236,6 +1238,7 @@ static int rpc_struct_add(struct rpc_struct_l *s, char *fmt, ...) err = binrpc_end_struct(&s->pkt); if(err < 0) { LM_ERR("failed to end struct (%c)\n", *fmt); + ctl_free(rs); goto error_add; } clist_append(&s->substructs, rs, next, prev); @@ -1291,8 +1294,8 @@ static int rpc_array_add(struct rpc_struct_l *s, char *fmt, ...) va_list ap; int err; str st; - str *sp; - struct rpc_struct_l *rs; + str *sp = NULL; + struct rpc_struct_l *rs = NULL; str null_value = str_init("<null string>"); double d; @@ -1336,12 +1339,14 @@ static int rpc_array_add(struct rpc_struct_l *s, char *fmt, ...) if(err < 0) goto error_add; rs = new_rpc_struct(); - if(rs == 0) + if(rs == NULL) goto error_mem; rs->offset = binrpc_pkt_len(&s->pkt); err = binrpc_end_struct(&s->pkt); - if(err < 0) + if(err < 0) { + ctl_free(rs); goto error_add; + } clist_append(&s->substructs, rs, next, prev); *(va_arg(ap, void **)) = rs; break;
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
17
18
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Results per page:
10
25
50
100
200