From: Dragos Oancea Date: Thu, 30 Jan 2020 15:13:34 +0000 (+0000) Subject: [core] fix memory leak on playback, in certain error conditions (eg: native file... X-Git-Tag: v1.10.3^2~233^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F275%2Fhead;p=thirdparty%2Ffreeswitch.git [core] fix memory leak on playback, in certain error conditions (eg: native file related) --- diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 339515faec..e4f6de3552 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1474,11 +1474,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess interval = read_impl.microseconds_per_packet / 1000; - if (!fh->audio_buffer) { - switch_buffer_create_dynamic(&fh->audio_buffer, FILE_BLOCKSIZE, FILE_BUFSIZE, 0); - switch_assert(fh->audio_buffer); - } - codec_name = "L16"; if (!switch_core_codec_ready((&codec))) { @@ -1589,6 +1584,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_event_fire(&event); } + if (!fh->audio_buffer) { + switch_buffer_create_dynamic(&fh->audio_buffer, FILE_BLOCKSIZE, FILE_BUFSIZE, 0); + switch_assert(fh->audio_buffer); + } + for (;;) { int do_speed = 1; int last_speed = -1;