diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-08-29 09:40:39 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-08-29 18:49:51 +0200 |
commit | 5ff2ff6bd9cd9e08729060d330e381a09972c498 (patch) | |
tree | 877c63393968a1e56e77e20b2e479777c2ac3e97 /libavcodec/mediacodec.h | |
parent | abd58a4192e4c5ea721b22365c211d8fa874f3d2 (diff) | |
download | ffmpeg-5ff2ff6bd9cd9e08729060d330e381a09972c498.tar.gz |
avcodec/truemotion2: Avoid duplicating array, fix memleak
TrueMotion 2.0 uses Huffmann trees. To parse them, the decoder allocates
arrays for the codes, their lengths and their value; afterwards a VLC
table is initialized using these values. If everything up to this point
succeeds, a new buffer of the same size as the already allocated arrays
for the values is allocated and upon success the values are copied into
the new array; all the old arrays are then freed. Yet if allocating the
new array fails, the old arrays get freed, but the VLC table doesn't.
This leak is fixed by not allocating a new array at all; instead the old
array is simply reused, ensuring that nothing can fail after the
creation of the VLC table.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/mediacodec.h')
0 files changed, 0 insertions, 0 deletions