if (!x->twopassbuffer || !x->old_twopassbuffer) {
av_log(avctx, AV_LOG_ERROR,
"Xvid: Cannot allocate 2-pass log buffers\n");
if (!x->twopassbuffer || !x->old_twopassbuffer) {
av_log(avctx, AV_LOG_ERROR,
"Xvid: Cannot allocate 2-pass log buffers\n");
rc2pass2.bitrate = avctx->bit_rate;
fd = av_tempfile("xvidff.", &x->twopassfile, 0, avctx);
rc2pass2.bitrate = avctx->bit_rate;
fd = av_tempfile("xvidff.", &x->twopassfile, 0, avctx);
if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR,
"Xvid: No 2-pass information loaded for second pass\n");
if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR,
"Xvid: No 2-pass information loaded for second pass\n");
- if (strlen(avctx->stats_in) >
- write(fd, avctx->stats_in, strlen(avctx->stats_in))) {
+ ret = write(fd, avctx->stats_in, strlen(avctx->stats_in));
+ if (ret == -1)
+ ret = AVERROR(errno);
+ else if (strlen(avctx->stats_in) > ret) {
av_freep(&x->twopassfile);
av_freep(&x->intra_matrix);
av_freep(&x->inter_matrix);
av_freep(&x->twopassfile);
av_freep(&x->intra_matrix);
av_freep(&x->inter_matrix);