mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-24 00:02:52 +00:00
lavu/mem: Allow allocations close to max_alloc_size with av_fast_realloc().
This commit is contained in:
parent
f141b353e6
commit
695b1d8111
@ -466,7 +466,12 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
|
|||||||
if (min_size <= *size)
|
if (min_size <= *size)
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
|
if (min_size > max_alloc_size - 32) {
|
||||||
|
*size = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
min_size = FFMIN(max_alloc_size - 32, FFMAX(min_size + min_size / 16 + 32, min_size));
|
||||||
|
|
||||||
ptr = av_realloc(ptr, min_size);
|
ptr = av_realloc(ptr, min_size);
|
||||||
/* we could set this to the unmodified min_size but this is safer
|
/* we could set this to the unmodified min_size but this is safer
|
||||||
|
Loading…
Reference in New Issue
Block a user