Revision 5228bcd8 libavcodec/svq1dec.c

View differences:

libavcodec/svq1dec.c
650 650
  uint8_t        *current, *previous;
651 651
  int             result, i, x, y, width, height;
652 652
  AVFrame *pict = data;
653
  svq1_pmv *pmv;
653 654

  
654 655
  /* initialize bit buffer */
655 656
  init_get_bits(&s->gb,buf,buf_size*8);
......
692 693
  if(MPV_frame_start(s, avctx) < 0)
693 694
      return -1;
694 695

  
696
  pmv = av_malloc((FFALIGN(s->width, 16)/8 + 3) * sizeof(*pmv));
697
  if (!pmv)
698
      return -1;
699

  
695 700
  /* decode y, u and v components */
696 701
  for (i=0; i < 3; i++) {
697 702
    int linesize;
......
724 729
//#ifdef DEBUG_SVQ1
725 730
            av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n",result);
726 731
//#endif
727
            return result;
732
            goto err;
728 733
          }
729 734
        }
730 735
        current += 16*linesize;
731 736
      }
732 737
    } else {
733
      svq1_pmv pmv[width/8+3];
734 738
      /* delta frame */
735 739
      memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));
736 740

  
......
743 747
#ifdef DEBUG_SVQ1
744 748
    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_delta_block %i\n",result);
745 749
#endif
746
            return result;
750
            goto err;
747 751
          }
748 752
        }
749 753

  
......
761 765
  MPV_frame_end(s);
762 766

  
763 767
  *data_size=sizeof(AVFrame);
764
  return buf_size;
768
  result = buf_size;
769
err:
770
  av_free(pmv);
771
  return result;
765 772
}
766 773

  
767 774
static av_cold int svq1_decode_init(AVCodecContext *avctx)

Also available in: Unified diff