Commit 7464a260 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/audiointerleave: Fix memleak

If ff_interleave_add_packet failed, the content of the newly created
packet new_pkt would leak.

Also, it is unnecessary to zero-initialize a packet that will be put
into av_new_packet lateron as the latter already initializes the packet.
Therefore this has been removed, too.
Reviewed-by: 's avatarMarton Balint <cus@passwd.hu>
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent f4190a49
......@@ -134,10 +134,12 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
AVPacket new_pkt = { 0 };
AVPacket new_pkt;
while ((ret = interleave_new_audio_packet(s, &new_pkt, i, flush)) > 0) {
if ((ret = ff_interleave_add_packet(s, &new_pkt, compare_ts)) < 0)
if ((ret = ff_interleave_add_packet(s, &new_pkt, compare_ts)) < 0) {
av_packet_unref(&new_pkt);
return ret;
}
}
if (ret < 0)
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment