mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-18 09:32:34 +00:00
FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_profile.c
This commit is contained in:
parent
69721f8266
commit
04c8e06196
@ -306,13 +306,16 @@ SWITCH_DECLARE(switch_profile_timer_t *)switch_new_profile_timer(void)
|
|||||||
unsigned int x;
|
unsigned int x;
|
||||||
switch_profile_timer_t *p = calloc(1, sizeof(switch_profile_timer_t));
|
switch_profile_timer_t *p = calloc(1, sizeof(switch_profile_timer_t));
|
||||||
|
|
||||||
if ( runtime.cpu_idle_smoothing_depth && runtime.cpu_idle_smoothing_depth > 0 ) {
|
if (!p) return NULL;
|
||||||
|
|
||||||
|
if (runtime.cpu_idle_smoothing_depth > 0) {
|
||||||
p->cpu_idle_smoothing_depth = runtime.cpu_idle_smoothing_depth;
|
p->cpu_idle_smoothing_depth = runtime.cpu_idle_smoothing_depth;
|
||||||
} else {
|
} else {
|
||||||
p->cpu_idle_smoothing_depth = 30;
|
p->cpu_idle_smoothing_depth = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->percentage_of_idle_time_ring = calloc(1, sizeof(double) * p->cpu_idle_smoothing_depth);
|
p->percentage_of_idle_time_ring = calloc(1, sizeof(double) * p->cpu_idle_smoothing_depth);
|
||||||
|
switch_assert(p->percentage_of_idle_time_ring);
|
||||||
|
|
||||||
for ( x = 0; x < p->cpu_idle_smoothing_depth; x++ ) {
|
for ( x = 0; x < p->cpu_idle_smoothing_depth; x++ ) {
|
||||||
p->percentage_of_idle_time_ring[x] = 100.0;
|
p->percentage_of_idle_time_ring[x] = 100.0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user