Merge pull request #275 from dragos-oancea/memleak_playback_err

[core] fix memory leak on playback, in certain error conditions (eg: native file related)
This commit is contained in:
Andrey Volk 2020-01-30 23:25:47 +04:00 committed by GitHub
commit 42473043f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -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; 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"; codec_name = "L16";
if (!switch_core_codec_ready((&codec))) { 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); 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 (;;) { for (;;) {
int do_speed = 1; int do_speed = 1;
int last_speed = -1; int last_speed = -1;