diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-01-14 04:13:36 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-02-25 19:57:16 +0100 |
commit | da304e78b5175cb45b06116006e1901cef077ffd (patch) | |
tree | 299eaeed4e0a8a35ab5452761a16dc504195b764 /libavformat/segafilmenc.c | |
parent | ab44f0aee88032d2a406b689ff2ff144cf26b0ef (diff) | |
download | ffmpeg-da304e78b5175cb45b06116006e1901cef077ffd.tar.gz |
avformat/segafilmenc: Add deinit function
Prevents memleaks when the trailer is never written or when shifting the
data fails when writing the trailer.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/segafilmenc.c')
-rw-r--r-- | libavformat/segafilmenc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/segafilmenc.c b/libavformat/segafilmenc.c index 7778609e9a..93c482ef7d 100644 --- a/libavformat/segafilmenc.c +++ b/libavformat/segafilmenc.c @@ -360,10 +360,23 @@ static int film_write_header(AVFormatContext *format_context) packet = packet->next; av_freep(&prev); } + film->start = film->last = NULL; return 0; } +static void film_deinit(AVFormatContext *format_context) +{ + FILMOutputContext *film = format_context->priv_data; + FILMPacket *packet = film->start; + while (packet != NULL) { + FILMPacket *next = packet->next; + av_free(packet); + packet = next; + } + film->start = film->last = NULL; +} + AVOutputFormat ff_segafilm_muxer = { .name = "film_cpk", .long_name = NULL_IF_CONFIG_SMALL("Sega FILM / CPK"), @@ -374,4 +387,5 @@ AVOutputFormat ff_segafilm_muxer = { .init = film_init, .write_trailer = film_write_header, .write_packet = film_write_packet, + .deinit = film_deinit, }; |