mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-26 10:20:52 +08:00
mem: Introduce av_reallocp
This commit is contained in:
@@ -136,6 +136,22 @@ void *av_realloc(void *ptr, size_t size)
|
||||
#endif
|
||||
}
|
||||
|
||||
int av_reallocp(void *ptr, size_t size)
|
||||
{
|
||||
void **ptrptr = ptr;
|
||||
void *ret;
|
||||
|
||||
ret = av_realloc(*ptrptr, size);
|
||||
|
||||
if (!ret) {
|
||||
av_freep(ptr);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
*ptrptr = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
if (!size || nmemb >= INT_MAX / size)
|
||||
|
||||
Reference in New Issue
Block a user