aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorWill Kelleher <wkelleher@gogoair.com>2016-04-07 08:58:31 -0500
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-15 01:30:53 +0200
commit964f07f68e1cc4e2d585615e2b1a1fade269afb0 (patch)
tree5a04e3ce7977e8bf132cd94cc44ad4758cdfd621 /libavcodec
parent6543a72fcefca574691a65ba7b80c1f190eaba1e (diff)
downloadffmpeg-964f07f68e1cc4e2d585615e2b1a1fade269afb0.tar.gz
hevc: Fix memory leak related to a53_caption data
Signed-off-by: Will Kelleher <wkelleher@gogoair.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc.c2
-rw-r--r--libavcodec/hevc.h9
-rw-r--r--libavcodec/hevc_parser.c2
-rw-r--r--libavcodec/hevc_sei.c6
4 files changed, 19 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index d1aa0b06d0..b478065db2 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -3155,6 +3155,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 f44fa492ce..be91010378 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -1054,6 +1054,15 @@ void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size);
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 1227358b9d..b5633f16ef 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -211,6 +211,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 40685fe5d8..f598b6393a 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);
+}