avcodec/hevc_ps: prevent stale pointer in malloc failure case
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 15 Jul 2014 19:43:04 +0000 (21:43 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 15 Jul 2014 19:49:56 +0000 (21:49 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/hevc_ps.c

index ba166cb..98d987d 100644 (file)
@@ -1016,6 +1016,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
         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]);
+            if (!s->current_sps)
+                s->sps = NULL;
         }
         av_buffer_unref(&s->sps_list[sps_id]);
         s->sps_list[sps_id] = sps_buf;