Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
lvl = avctx->compression_level;
if(lvl < 0 || lvl > 9){
av_log(avctx, AV_LOG_ERROR, "Compression level should be 0-9, not %i\n", lvl);
lvl = avctx->compression_level;
if(lvl < 0 || lvl > 9){
av_log(avctx, AV_LOG_ERROR, "Compression level should be 0-9, not %i\n", lvl);
+ return AVERROR(EINVAL);
}
// Needed if zlib unused or init aborted before deflateInit
}
// Needed if zlib unused or init aborted before deflateInit
((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
+ return AVERROR(ENOMEM);
}
/* Conservative upper bound taken from zlib v1.2.1 source via lcl.c */
c->comp_size = c->comp_size + ((c->comp_size + 7) >> 3) +
}
/* Conservative upper bound taken from zlib v1.2.1 source via lcl.c */
c->comp_size = c->comp_size + ((c->comp_size + 7) >> 3) +
/* Allocate compression buffer */
if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
/* Allocate compression buffer */
if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
+ return AVERROR(ENOMEM);
}
c->pstride = FFALIGN(avctx->width, 16);
if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
}
c->pstride = FFALIGN(avctx->width, 16);
if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
+ return AVERROR(ENOMEM);
}
c->zstream.zalloc = Z_NULL;
}
c->zstream.zalloc = Z_NULL;