Revision 68e5d523 libavcodec/mpegvideo.c

View differences:

libavcodec/mpegvideo.c
170 170
static void free_frame_buffer(MpegEncContext *s, Picture *pic)
171 171
{
172 172
    s->avctx->release_buffer(s->avctx, (AVFrame*)pic);
173
    av_freep(&pic->hwaccel_data_private);
173 174
}
174 175

  
175 176
/**
......
179 180
{
180 181
    int r;
181 182

  
183
    if (s->avctx->hwaccel) {
184
        assert(!pic->hwaccel_data_private);
185
        if (s->avctx->hwaccel->priv_data_size) {
186
            pic->hwaccel_data_private = av_malloc(s->avctx->hwaccel->priv_data_size);
187
            if (!pic->hwaccel_data_private) {
188
                av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
189
                return -1;
190
            }
191
        }
192
    }
193

  
182 194
    r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic);
183 195

  
184 196
    if (r<0 || !pic->age || !pic->type || !pic->data[0]) {
185 197
        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
198
        av_freep(&pic->hwaccel_data_private);
186 199
        return -1;
187 200
    }
188 201

  

Also available in: Unified diff