avcodec/hevcdec: Check allocation

Also postpone it after the checks for invalid input.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-06-30 20:11:20 +02:00
parent ad2b755d3f
commit db99ca2150
1 changed files with 3 additions and 2 deletions

View File

@ -2649,8 +2649,6 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
goto error;
}
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
for (i = 1; i < s->threads_number; i++) {
if (s->HEVClcList[i])
continue;
@ -2704,6 +2702,9 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
}
atomic_store(&s->wpp_err, 0);
res = ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
if (res < 0)
goto error;
ff_reset_entries(s->avctx);
for (i = 0; i <= s->sh.num_entry_point_offsets; i++) {