Commit 2e37237f authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

avformat/aiffenc: Add deinit function

Prevents memleaks if the trailer is never written.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 296296a4
...@@ -260,7 +260,7 @@ static int aiff_write_trailer(AVFormatContext *s) ...@@ -260,7 +260,7 @@ static int aiff_write_trailer(AVFormatContext *s)
/* Write ID3 tags */ /* Write ID3 tags */
if (aiff->write_id3v2) if (aiff->write_id3v2)
if ((ret = put_id3v2_tags(s, aiff)) < 0) if ((ret = put_id3v2_tags(s, aiff)) < 0)
goto free; return ret;
/* File length */ /* File length */
file_size = avio_tell(pb); file_size = avio_tell(pb);
...@@ -270,12 +270,16 @@ static int aiff_write_trailer(AVFormatContext *s) ...@@ -270,12 +270,16 @@ static int aiff_write_trailer(AVFormatContext *s)
avio_flush(pb); avio_flush(pb);
} }
free:
ff_packet_list_free(&aiff->pict_list, &aiff->pict_list_end);
return ret; return ret;
} }
static void aiff_deinit(AVFormatContext *s)
{
AIFFOutputContext *aiff = s->priv_data;
ff_packet_list_free(&aiff->pict_list, &aiff->pict_list_end);
}
#define OFFSET(x) offsetof(AIFFOutputContext, x) #define OFFSET(x) offsetof(AIFFOutputContext, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM #define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = { static const AVOption options[] = {
...@@ -304,6 +308,7 @@ AVOutputFormat ff_aiff_muxer = { ...@@ -304,6 +308,7 @@ AVOutputFormat ff_aiff_muxer = {
.write_header = aiff_write_header, .write_header = aiff_write_header,
.write_packet = aiff_write_packet, .write_packet = aiff_write_packet,
.write_trailer = aiff_write_trailer, .write_trailer = aiff_write_trailer,
.deinit = aiff_deinit,
.codec_tag = (const AVCodecTag* const []){ ff_codec_aiff_tags, 0 }, .codec_tag = (const AVCodecTag* const []){ ff_codec_aiff_tags, 0 },
.priv_class = &aiff_muxer_class, .priv_class = &aiff_muxer_class,
}; };
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