mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/ivi: Fix segfault on allocation error
If allocating the tiles array for indeo 4/5 fails, the context is in an inconsistent state, because the counter for the number of tiles is > 0. This will lead to a segfault when freeing the tiles' substructures. Fix this by setting the number of tiles to zero if the allocation was unsuccessful. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
a53f32cf49
commit
e411a3af11
@ -442,8 +442,10 @@ av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes,
|
||||
|
||||
av_freep(&band->tiles);
|
||||
band->tiles = av_mallocz_array(band->num_tiles, sizeof(IVITile));
|
||||
if (!band->tiles)
|
||||
if (!band->tiles) {
|
||||
band->num_tiles = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
/* use the first luma band as reference for motion vectors
|
||||
* and quant */
|
||||
|
Loading…
Reference in New Issue
Block a user