aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/motion_est_template.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-20 12:28:03 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-23 17:09:01 +0200
commit3f04c3037223f5e5417a14674103f3eeabb4887c (patch)
treed8b7820a096a37d4aba5ad5886c7f84f636dd7ca /libavcodec/motion_est_template.c
parent28dc0c20cc51346ba7891a324b35e0ef6295c9dd (diff)
downloadffmpeg-3f04c3037223f5e5417a14674103f3eeabb4887c.tar.gz
avformat/swfdec: Reorder allocations/initializations
The earlier code would first attempt to allocate two buffers, then attempt to allocate an AVIOContext, using one of the new buffers I/O buffer, then check the allocations. On success, a z_stream that is used in the AVIOContext's read_packet callback is initialized afterwards. There are two problems with this: In case the allocation of the I/O buffer fails avio_alloc_context() will be given a NULL read buffer with a size > 0. This works right now, but it is fragile. The second problem is that the z_stream used in the read_packet callback is not functional when avio_alloc_context() is allocated (it might be that avio_alloc_context() might already fill the buffer in the future). This commit fixes both of these problems by reordering the operations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/motion_est_template.c')
0 files changed, 0 insertions, 0 deletions