mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
format_ogg_vorbis: Clear ogg/vorbis data structures on close
On filestream close, we need to clear out the ogg & vorbis data structures to prevent a memory leak. ASTERISK-26169 #close Reported by: Ivan Myalkin Change-Id: Iee94c5a5d5bdafbf8b181c5c064d15d90ace8274
This commit is contained in:
@@ -158,6 +158,7 @@ static int ogg_vorbis_rewrite(struct ast_filestream *s,
|
|||||||
|
|
||||||
if (vorbis_encode_init_vbr(&tmp->vi, 1, DEFAULT_SAMPLE_RATE, 0.4)) {
|
if (vorbis_encode_init_vbr(&tmp->vi, 1, DEFAULT_SAMPLE_RATE, 0.4)) {
|
||||||
ast_log(LOG_ERROR, "Unable to initialize Vorbis encoder!\n");
|
ast_log(LOG_ERROR, "Unable to initialize Vorbis encoder!\n");
|
||||||
|
vorbis_info_clear(&tmp->vi);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +274,13 @@ static void ogg_vorbis_close(struct ast_filestream *fs)
|
|||||||
* and write out the rest of the data */
|
* and write out the rest of the data */
|
||||||
vorbis_analysis_wrote(&s->vd, 0);
|
vorbis_analysis_wrote(&s->vd, 0);
|
||||||
write_stream(s, fs->f);
|
write_stream(s, fs->f);
|
||||||
|
|
||||||
|
/* Cleanup */
|
||||||
|
ogg_stream_clear(&s->os);
|
||||||
|
vorbis_block_clear(&s->vb);
|
||||||
|
vorbis_dsp_clear(&s->vd);
|
||||||
|
vorbis_comment_clear(&s->vc);
|
||||||
|
vorbis_info_clear(&s->vi);
|
||||||
} else {
|
} else {
|
||||||
/* clear OggVorbis_File handle */
|
/* clear OggVorbis_File handle */
|
||||||
ov_clear(&s->ov_f);
|
ov_clear(&s->ov_f);
|
||||||
|
Reference in New Issue
Block a user