Revision 2a9b5c9b libavcodec/utils.c

View differences:

libavcodec/utils.c
475 475
    if (((avctx->coded_width || avctx->coded_height)
476 476
        && avcodec_check_dimensions(avctx, avctx->coded_width, avctx->coded_height))
477 477
        || avctx->channels > SANE_NB_CHANNELS) {
478
        av_freep(&avctx->priv_data);
479 478
        ret = AVERROR(EINVAL);
480
        goto end;
479
        goto free_and_end;
481 480
    }
482 481

  
483 482
    avctx->codec = codec;
484 483
    if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){
485 484
        av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n");
486
        goto end;
485
        goto free_and_end;
487 486
    }
488 487
    avctx->frame_number = 0;
489 488
    if(avctx->codec->init){
490 489
        ret = avctx->codec->init(avctx);
491 490
        if (ret < 0) {
492
            av_freep(&avctx->priv_data);
493
            avctx->codec= NULL;
494
            goto end;
491
            goto free_and_end;
495 492
        }
496 493
    }
497 494
    ret=0;
......
503 500
        (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
504 501
    }
505 502
    return ret;
503
free_and_end:
504
    av_freep(&avctx->priv_data);
505
    avctx->codec= NULL;
506
    goto end;
506 507
}
507 508

  
508 509
int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,

Also available in: Unified diff