Commit 07f606b4 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'e1ea365f'

* commit 'e1ea365f':
  truemotion2: Check memory allocation

Conflicts:
	libavcodec/truemotion2.c

See: d49f2603Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f24b7d76 e1ea365f
...@@ -177,7 +177,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) ...@@ -177,7 +177,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
if (!huff.nums || !huff.bits || !huff.lens) { if (!huff.nums || !huff.bits || !huff.lens) {
res = AVERROR(ENOMEM); res = AVERROR(ENOMEM);
goto fail; goto out;
} }
res = tm2_read_tree(ctx, 0, 0, &huff); res = tm2_read_tree(ctx, 0, 0, &huff);
...@@ -203,13 +203,14 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) ...@@ -203,13 +203,14 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
code->recode = av_malloc_array(code->length, sizeof(int)); code->recode = av_malloc_array(code->length, sizeof(int));
if (!code->recode) { if (!code->recode) {
res = AVERROR(ENOMEM); res = AVERROR(ENOMEM);
goto fail; goto out;
} }
for (i = 0; i < code->length; i++) for (i = 0; i < code->length; i++)
code->recode[i] = huff.nums[i]; code->recode[i] = huff.nums[i];
} }
} }
fail:
out:
/* free allocated memory */ /* free allocated memory */
av_free(huff.nums); av_free(huff.nums);
av_free(huff.bits); av_free(huff.bits);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment