Module: kamailio Branch: 5.3 Commit: 67cd116cdb05511cbf889a6f4418830c35ec77c3 URL: https://github.com/kamailio/kamailio/commit/67cd116cdb05511cbf889a6f4418830c35ec77c3
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2019-10-17T10:51:45+02:00 statsc: free parsed params in case of error - wrap some lines of codes in blocks (cherry picked from commit 27020d88b4d3206a8f193dc5343ea8bb5b39b5a1) --- Modified: src/modules/statsc/statsc_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/67cd116cdb05511cbf889a6f4418830c35ec77c3.diff Patch: https://github.com/kamailio/kamailio/commit/67cd116cdb05511cbf889a6f4418830c35ec77c3.patch --- 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); _______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev