Module: kamailio
Branch: master
Commit: 263b8ce5360716e44c6a7bcdbc65a76dfad67575
URL:
https://github.com/kamailio/kamailio/commit/263b8ce5360716e44c6a7bcdbc65a76…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-12-09T22:17:40+01:00
tm: rework code to avoid compiler warnings
- fix log message priting wrong string variable
---
Modified: src/modules/tm/t_suspend.c
Modified: src/modules/tm/tm.c
---
Diff:
https://github.com/kamailio/kamailio/commit/263b8ce5360716e44c6a7bcdbc65a76…
Patch:
https://github.com/kamailio/kamailio/commit/263b8ce5360716e44c6a7bcdbc65a76…
---
diff --git a/src/modules/tm/t_suspend.c b/src/modules/tm/t_suspend.c
index 949340f1ce..d2275a6151 100644
--- a/src/modules/tm/t_suspend.c
+++ b/src/modules/tm/t_suspend.c
@@ -165,8 +165,8 @@ int t_continue_helper(unsigned int hash_index, unsigned int label,
tm_cell_t *backup_T = T_UNDEFINED;
int backup_T_branch = T_BR_UNDEFINED;
sip_msg_t *faked_req;
- sip_msg_t *brpl;
- void *erpl;
+ sip_msg_t *brpl = NULL;
+ void *erpl = NULL;
int faked_req_len = 0;
struct cancel_info cancel_data;
int branch;
@@ -499,46 +499,48 @@ int t_continue_helper(unsigned int hash_index, unsigned int label,
} else {
/* response handling */
tm_ctx_set_branch_index(T_BR_UNDEFINED);
- /* unref the transaction */
- t_unref(brpl);
- LM_DBG("Freeing earlier cloned reply\n");
-
- /* free lumps that were added during reply processing */
- del_nonshm_lump( &(brpl->add_rm) );
- del_nonshm_lump( &(brpl->body_lumps) );
- del_nonshm_lump_rpl( &(brpl->reply_lump) );
-
- /* free header's parsed structures that were added */
- for( hdr=brpl->headers ; hdr ; hdr=hdr->next ) {
- if ( hdr->parsed && hdr_allocs_parse(hdr) &&
- (hdr->parsed<(void*)brpl ||
- hdr->parsed>=(void*)erpl)) {
- clean_hdr_field(hdr);
- hdr->parsed = 0;
+ if(brpl) {
+ /* unref the transaction */
+ t_unref(brpl);
+ LM_DBG("Freeing earlier cloned reply\n");
+
+ /* free lumps that were added during reply processing */
+ del_nonshm_lump( &(brpl->add_rm) );
+ del_nonshm_lump( &(brpl->body_lumps) );
+ del_nonshm_lump_rpl( &(brpl->reply_lump) );
+
+ /* free header's parsed structures that were added */
+ for( hdr=brpl->headers ; hdr ; hdr=hdr->next ) {
+ if (hdr->parsed && hdr_allocs_parse(hdr) &&
+ (hdr->parsed<(void*)brpl ||
+ (erpl && hdr->parsed>=(void*)erpl))) {
+ clean_hdr_field(hdr);
+ hdr->parsed = 0;
+ }
}
- }
- /* now go through hdr fields themselves
- * and remove the pkg allocated space */
- hdr = brpl->headers;
- while (hdr) {
- if ( hdr && ((void*)hdr<(void*)brpl ||
- (void*)hdr>=(void*)erpl)) {
- /* this header needs to be freed and removed form the list */
- if (!prev) {
- brpl->headers = hdr->next;
+ /* now go through hdr fields themselves
+ * and remove the pkg allocated space */
+ hdr = brpl->headers;
+ while (hdr) {
+ if ( hdr && ((void*)hdr<(void*)brpl ||
+ (void*)hdr>=(void*)erpl)) {
+ /* this header needs to be freed and removed form the list */
+ if (!prev) {
+ brpl->headers = hdr->next;
+ } else {
+ prev->next = hdr->next;
+ }
+ tmp = hdr;
+ hdr = hdr->next;
+ pkg_free(tmp);
} else {
- prev->next = hdr->next;
+ prev = hdr;
+ hdr = hdr->next;
}
- tmp = hdr;
- hdr = hdr->next;
- pkg_free(tmp);
- } else {
- prev = hdr;
- hdr = hdr->next;
}
+ sip_msg_free(brpl);
}
- sip_msg_free(brpl);
}
set_t(backup_T, backup_T_branch);
diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c
index da47c60527..39180442e2 100644
--- a/src/modules/tm/tm.c
+++ b/src/modules/tm/tm.c
@@ -1054,7 +1054,7 @@ static int ki_t_check_status(sip_msg_t* msg, str *sexp)
{
regmatch_t pmatch;
struct cell *t;
- char *status, *s = NULL;
+ char *status = NULL;
char backup;
int lowest_status, n, ret;
regex_t re;
@@ -1071,7 +1071,7 @@ static int ki_t_check_status(sip_msg_t* msg, str *sexp)
memset(&re, 0, sizeof(regex_t));
if (regcomp(&re, sexp->s, REG_EXTENDED|REG_ICASE|REG_NEWLINE)) {
- LM_ERR("Bad regular expression '%s'\n", s);
+ LM_ERR("Bad regular expression '%s'\n", sexp->s);
goto error0;
}