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.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
return 0;
}
+static void webp_deinit(AVFormatContext *s)
+{
+ WebpContext *w = s->priv_data;
+
+ av_packet_unref(&w->last_pkt);
+}
+
#define OFFSET(x) offsetof(WebpContext, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
.init = webp_init,
.write_packet = webp_write_packet,
.write_trailer = webp_write_trailer,
+ .deinit = webp_deinit,
.priv_class = &webp_muxer_class,
.flags = AVFMT_VARIABLE_FPS,
};