History

avformat/webpenc: Fix memleak when trailer is never written

When the trailer is never written (or when a stream switches from non-animation mode to animation mode mid-stream), a cached packet (if existing) would leak. Fix this by adding a deinit function.

Andreas Rheinhardt committed 5 years ago

Commit 3903c131 parent df9d9691 file · +8 −0Browse files

Unified · Split

libavformat/webpenc.c+8−0
@@ -191,6 +191,13 @@ static int webp_write_trailer(AVFormatContext *s) · 190 unmodified lines
191 return 0;191 return 0;
192}192}
193 193
194static void webp_deinit(AVFormatContext *s)
195{
196 WebpContext *w = s->priv_data;
197
198 av_packet_unref(&w->last_pkt);
199}
200
194#define OFFSET(x) offsetof(WebpContext, x)201#define OFFSET(x) offsetof(WebpContext, x)
195#define ENC AV_OPT_FLAG_ENCODING_PARAM202#define ENC AV_OPT_FLAG_ENCODING_PARAM
196static const AVOption options[] = {203static const AVOption options[] = {
@@ -214,6 +221,7 @@ AVOutputFormat ff_webp_muxer = { · 17 unmodified lines
214 .init = webp_init,221 .init = webp_init,
215 .write_packet = webp_write_packet,222 .write_packet = webp_write_packet,
216 .write_trailer = webp_write_trailer,223 .write_trailer = webp_write_trailer,
224 .deinit = webp_deinit,
217 .priv_class = &webp_muxer_class,225 .priv_class = &webp_muxer_class,
218 .flags = AVFMT_VARIABLE_FPS,226 .flags = AVFMT_VARIABLE_FPS,
219};227};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t