Unified · Split
| @@ -515,6 +515,9 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, · 514 unmodified lines | ||
| 515 | 515 | s->sao_pixel_buffer_v[c_idx] = |
| 516 | 516 | av_malloc((h * 2 * sps->ctb_width) << |
| 517 | 517 | sps->pixel_shift); |
| 518 | + if (!s->sao_pixel_buffer_h[c_idx] || | |
| 519 | + !s->sao_pixel_buffer_v[c_idx]) | |
| 520 | + goto fail; | |
| 518 | 521 | } |
| 519 | 522 | } |
| 520 | 523 | |
| @@ -525,6 +528,10 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, · 4 unmodified lines | ||
| 525 | 528 | |
| 526 | 529 | fail: |
| 527 | 530 | pic_arrays_free(s); |
| 531 | + for (i = 0; i < 3; i++) { | |
| 532 | + av_freep(&s->sao_pixel_buffer_h[i]); | |
| 533 | + av_freep(&s->sao_pixel_buffer_v[i]); | |
| 534 | + } | |
| 528 | 535 | s->ps.sps = NULL; |
| 529 | 536 | return ret; |
| 530 | 537 | } |
| @@ -2624,13 +2631,19 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal) · 2093 unmodified lines | ||
| 2624 | 2631 | |
| 2625 | 2632 | ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1); |
| 2626 | 2633 | |
| 2627 | − if (!s->sList[1]) { | |
| 2628 | − for (i = 1; i < s->threads_number; i++) { | |
| 2629 | − s->sList[i] = av_malloc(sizeof(HEVCContext)); | |
| 2630 | − memcpy(s->sList[i], s, sizeof(HEVCContext)); | |
| 2631 | − s->HEVClcList[i] = av_mallocz(sizeof(HEVCLocalContext)); | |
| 2632 | − s->sList[i]->HEVClc = s->HEVClcList[i]; | |
| 2634 | + for (i = 1; i < s->threads_number; i++) { | |
| 2635 | + if (s->sList[i] && s->HEVClcList[i]) | |
| 2636 | + continue; | |
| 2637 | + av_freep(&s->sList[i]); | |
| 2638 | + av_freep(&s->HEVClcList[i]); | |
| 2639 | + s->sList[i] = av_malloc(sizeof(HEVCContext)); | |
| 2640 | + s->HEVClcList[i] = av_mallocz(sizeof(HEVCLocalContext)); | |
| 2641 | + if (!s->sList[i] || !s->HEVClcList[i]) { | |
| 2642 | + res = AVERROR_INVALIDDATA; | |
| 2643 | + goto error; | |
| 2633 | 2644 | } |
| 2645 | + memcpy(s->sList[i], s, sizeof(HEVCContext)); | |
| 2646 | + s->sList[i]->HEVClc = s->HEVClcList[i]; | |
| 2634 | 2647 | } |
| 2635 | 2648 | |
| 2636 | 2649 | offset = (lc->gb.index >> 3); |