[FFmpeg-cvslog] hevc: Fix memory leak related to a53_caption data
Will Kelleher
git at videolan.org
Sun Jun 5 03:16:41 CEST 2016
ffmpeg | branch: release/3.0 | Will Kelleher <wkelleher at gogoair.com> | Thu Apr 7 08:58:31 2016 -0500| [7c43c48fda09cd734ad1e28ef2b8f0a2e197d4e0] | committer: Michael Niedermayer
hevc: Fix memory leak related to a53_caption data
Signed-off-by: Will Kelleher <wkelleher at gogoair.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 964f07f68e1cc4e2d585615e2b1a1fade269afb0)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c43c48fda09cd734ad1e28ef2b8f0a2e197d4e0
---
libavcodec/hevc.c | 2 ++
libavcodec/hevc.h | 9 +++++++++
libavcodec/hevc_parser.c | 2 ++
libavcodec/hevc_sei.c | 6 ++++++
4 files changed, 19 insertions(+)
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 203f90a..0e849b8 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -3149,6 +3149,8 @@ static av_cold int hevc_init_context(AVCodecContext *avctx)
s->context_initialized = 1;
s->eos = 0;
+ ff_hevc_reset_sei(s);
+
return 0;
fail:
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index c91f815..5d9d35c 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -1092,6 +1092,15 @@ int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, in
int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id,
uint8_t *buf, int buf_size);
+/**
+ * Reset SEI values that are stored on the Context.
+ * e.g. Caption data that was extracted during NAL
+ * parsing.
+ *
+ * @param s HEVCContext.
+ */
+void ff_hevc_reset_sei(HEVCContext *s);
+
extern const uint8_t ff_hevc_qpel_extra_before[4];
extern const uint8_t ff_hevc_qpel_extra_after[4];
extern const uint8_t ff_hevc_qpel_extra[4];
diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index 4625e61..d635716 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -209,6 +209,8 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
h->avctx = avctx;
+ ff_hevc_reset_sei(h);
+
if (!buf_size)
return 0;
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 40685fe..f598b63 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -373,3 +373,9 @@ int ff_hevc_decode_nal_sei(HEVCContext *s)
} while (more_rbsp_data(&s->HEVClc->gb));
return 1;
}
+
+void ff_hevc_reset_sei(HEVCContext *s)
+{
+ s->a53_caption_size = 0;
+ av_freep(&s->a53_caption);
+}
More information about the ffmpeg-cvslog
mailing list