Skip to content
Snippets Groups Projects
Commit e7b95918 authored by Reimar Döffinger's avatar Reimar Döffinger
Browse files

Use av_fast_malloc instead of av_realloc.

This should be faster, is less code and fixes issue 2524
(allocation error would lead to crash).
parent 7d508260
No related branches found
No related tags found
No related merge requests found
...@@ -116,8 +116,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit ...@@ -116,8 +116,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
return 0; return 0;
avctx->width = c->width = width; avctx->width = c->width = width;
avctx->height = c->height = height; avctx->height = c->height = height;
c->decomp_size = c->height * c->width * 3 / 2; av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2);
c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING);
if (!c->decomp_buf) { if (!c->decomp_buf) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment