Merge commit 'e1ea365f7e1477c78865b866a180712174536c20'

* commit 'e1ea365f7e1477c78865b866a180712174536c20':
  truemotion2: Check memory allocation

Conflicts:
	libavcodec/truemotion2.c

See: d49f2603be
Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/136/head
Michael Niedermayer 10 years ago
commit 07f606b4f0
  1. 7
      libavcodec/truemotion2.c

@ -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)
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);

Loading…
Cancel
Save