oggenc: free comment header for all codecs
fixes a memleak for Vorbis and Theora, where the comment header from avpriv_split_xiph_headers() is replaced by a buffer that must be freed separately.
This commit is contained in:
parent
be129271ea
commit
9677247b0a
@ -388,10 +388,10 @@ static int ogg_write_header(AVFormatContext *s)
|
|||||||
p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT,
|
p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT,
|
||||||
&oggstream->header_len[1], &s->metadata,
|
&oggstream->header_len[1], &s->metadata,
|
||||||
framing_bit);
|
framing_bit);
|
||||||
|
oggstream->header[1] = p;
|
||||||
if (!p)
|
if (!p)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
oggstream->header[1] = p;
|
|
||||||
bytestream_put_byte(&p, header_type);
|
bytestream_put_byte(&p, header_type);
|
||||||
bytestream_put_buffer(&p, cstr, 6);
|
bytestream_put_buffer(&p, cstr, 6);
|
||||||
|
|
||||||
@ -497,8 +497,8 @@ static int ogg_write_trailer(AVFormatContext *s)
|
|||||||
if (st->codec->codec_id == CODEC_ID_FLAC ||
|
if (st->codec->codec_id == CODEC_ID_FLAC ||
|
||||||
st->codec->codec_id == CODEC_ID_SPEEX) {
|
st->codec->codec_id == CODEC_ID_SPEEX) {
|
||||||
av_free(oggstream->header[0]);
|
av_free(oggstream->header[0]);
|
||||||
av_free(oggstream->header[1]);
|
|
||||||
}
|
}
|
||||||
|
av_freep(&oggstream->header[1]);
|
||||||
av_freep(&st->priv_data);
|
av_freep(&st->priv_data);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user