summaryrefslogtreecommitdiff
path: root/libavcodec/qtrleenc.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-06-19 13:03:03 +0200
committerStefano Sabatini <stefasab@gmail.com>2012-06-19 16:44:35 +0200
commit208c5a08da32916b5f0e078008341bb0a69c8609 (patch)
treea519b91f61758b3799b52c2c0527e5a34f7edea3 /libavcodec/qtrleenc.c
parent5793a6d9f9b35723f4aaeba68630f63b45d915f8 (diff)
lavc/qtrlenc: return proper error codes from qtrle_encode_init()
Diffstat (limited to 'libavcodec/qtrleenc.c')
-rw-r--r--libavcodec/qtrleenc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
index 6cbff30346..822e41899d 100644
--- a/libavcodec/qtrleenc.c
+++ b/libavcodec/qtrleenc.c
@@ -64,9 +64,10 @@ typedef struct QtrleEncContext {
static av_cold int qtrle_encode_init(AVCodecContext *avctx)
{
QtrleEncContext *s = avctx->priv_data;
+ int ret;
if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) {
- return -1;
+ return AVERROR(EINVAL);
}
s->avctx=avctx;
s->logical_width=avctx->width;
@@ -96,11 +97,11 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
s->length_table = av_mallocz((s->logical_width + 1)*sizeof(int));
if (!s->skip_table || !s->length_table || !s->rlecode_table) {
av_log(avctx, AV_LOG_ERROR, "Error allocating memory.\n");
- return -1;
+ return AVERROR(ENOMEM);
}
- if (avpicture_alloc(&s->previous_frame, avctx->pix_fmt, avctx->width, avctx->height) < 0) {
+ if ((ret = avpicture_alloc(&s->previous_frame, avctx->pix_fmt, avctx->width, avctx->height)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error allocating picture\n");
- return -1;
+ return ret;
}
s->max_buf_size = s->logical_width*s->avctx->height*s->pixel_size*2 /* image base material */