Module: kamailio Branch: master Commit: 27020d88b4d3206a8f193dc5343ea8bb5b39b5a1 URL: https://github.com/kamailio/kamailio/commit/27020d88b4d3206a8f193dc5343ea8bb...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2019-10-15T19:40:02+02:00
statsc: free parsed params in case of error
- wrap some lines of codes in blocks
---
Modified: src/modules/statsc/statsc_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/27020d88b4d3206a8f193dc5343ea8bb... Patch: https://github.com/kamailio/kamailio/commit/27020d88b4d3206a8f193dc5343ea8bb...
---
diff --git a/src/modules/statsc/statsc_mod.c b/src/modules/statsc/statsc_mod.c index 75c88c9cd5..0cbe246965 100644 --- a/src/modules/statsc/statsc_mod.c +++ b/src/modules/statsc/statsc_mod.c @@ -205,7 +205,7 @@ int statsc_nmap_add(str *sname, str *rname) return 0; } sl = _statsc_info->slist; - while(sl->next!=NULL) sl = sl->next; + while(sl->next!=NULL) { sl = sl->next; } sl->next = sm; _statsc_info->slots++; return 0; @@ -287,18 +287,23 @@ int statsc_track_param(modparam_t type, void* val) param_t *pit=NULL; str s;
- if(val==NULL) + if(val==NULL) { return -1; - if(statsc_init()<0) + } + if(statsc_init()<0) { return -1; + } s.s = (char*)val; s.len = strlen(s.s); - if(s.s[s.len-1]==';') + if(s.s[s.len-1]==';') { s.len--; - if (parse_params(&s, CLASS_ANY, &phooks, ¶ms_list)<0) + } + if (parse_params(&s, CLASS_ANY, &phooks, ¶ms_list)<0) { return -1; + } for (pit = params_list; pit; pit=pit->next) { if(statsc_nmap_add(&pit->name, &pit->body)<0) { + free_params(params_list); LM_ERR("cannot enable tracking statistics\n"); return -1; } @@ -369,8 +374,9 @@ static void statsc_rpc_report(rpc_t* rpc, void* ctx) sname.s = NULL; } rpc->scan(ctx, "*d", &range); - if(range<0 || range>statsc_items) + if(range<0 || range>statsc_items) { range = 0; + } }
tn = time(NULL);