FS-11792: [core] Fix memory leak in switch_ivr_originate.c

This commit is contained in:
Andrey Volk 2019-04-18 19:04:30 +04:00
parent 743cddc947
commit c86f66436e
1 changed files with 5 additions and 0 deletions

View File

@ -1364,6 +1364,11 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
}
SWITCH_IVR_VERIFY_SILENCE_DIVISOR(ringback->silence);
} else {
if (ringback->audio_buffer) {
switch_buffer_destroy(&ringback->audio_buffer);
teletone_destroy_session(&ringback->ts);
}
switch_buffer_create_dynamic(&ringback->audio_buffer, 512, 1024, 0);
switch_buffer_set_loops(ringback->audio_buffer, -1);