Browse code

avcodec/hevc_ps: prevent stale pointer in malloc failure case

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/07/16 04:43:04
Showing 1 changed files
... ...
@@ -1016,6 +1016,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
1016 1016
         if (s->sps_list[sps_id] && s->sps == (HEVCSPS*)s->sps_list[sps_id]->data) {
1017 1017
             av_buffer_unref(&s->current_sps);
1018 1018
             s->current_sps = av_buffer_ref(s->sps_list[sps_id]);
1019
+            if (!s->current_sps)
1020
+                s->sps = NULL;
1019 1021
         }
1020 1022
         av_buffer_unref(&s->sps_list[sps_id]);
1021 1023
         s->sps_list[sps_id] = sps_buf;