summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_ps.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-12 06:36:25 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-12 21:03:09 +0200
commitccd6911c189d2f974dcc4095c963dfad14d703d2 (patch)
treeaf9581f567817be451c6a4fd8b4618c77f6c77d5 /libavcodec/hevc_ps.c
parent52fafaf4740b78174e9da0d2aaaf3dd93ab33d63 (diff)
avcodec/hevc_ps: do not loose all reference to pointers still in use
Fixes leaving a pointer to unreferenced memory Fixes Ticket 3115 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc_ps.c')
-rw-r--r--libavcodec/hevc_ps.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index ee2c0ae6f4..dc843e89e0 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -964,6 +964,10 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
if (s->pps_list[i] && ((HEVCPPS*)s->pps_list[i]->data)->sps_id == sps_id)
av_buffer_unref(&s->pps_list[i]);
}
+ if (s->sps_list[sps_id] && s->sps == (HEVCSPS*)s->sps_list[sps_id]->data) {
+ av_buffer_unref(&s->current_sps);
+ s->current_sps = av_buffer_ref(s->sps_list[sps_id]);
+ }
av_buffer_unref(&s->sps_list[sps_id]);
s->sps_list[sps_id] = sps_buf;
}