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
191191 return 0;
192192 }
193193
194+static void webp_deinit(AVFormatContext *s)
195+{
196+ WebpContext *w = s->priv_data;
197+
198+ av_packet_unref(&w->last_pkt);
199+}
200+
194201 #define OFFSET(x) offsetof(WebpContext, x)
195202 #define ENC AV_OPT_FLAG_ENCODING_PARAM
196203 static const AVOption options[] = {
@@ -214,6 +221,7 @@ AVOutputFormat ff_webp_muxer = { · 17 unmodified lines
214221 .init = webp_init,
215222 .write_packet = webp_write_packet,
216223 .write_trailer = webp_write_trailer,
224+ .deinit = webp_deinit,
217225 .priv_class = &webp_muxer_class,
218226 .flags = AVFMT_VARIABLE_FPS,
219227 };

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