[FFmpeg-devel] av_mallocz_array
Christophe GARNIER
garnierchris at numericable.fr
Wed Mar 15 23:40:33 EET 2023
Hello,
To build makemkv version 1.17.3 (makemkv-oss), I retreived he sources of
ffmpeg from the git repository (git clone
https://git.ffmpeg.org/ffmpeg.git ffmpeg).It appeared that the function
av_mallocz_array is not present into libavutil/mem.c and libavutil/mem.h.
I had the following code into libavutil/mem.c :
void *av_mallocz_array(size_t nmemb, size_t size)
{
size_t result;
if (size_mult(nmemb, size, &result) < 0)
return NULL;
return av_mallocz(result);
}
and into libavutil/mem.h :
/**
* Allocate a memory block for an array with av_mallocz().
*
* The allocated memory will have size `size * nmemb` bytes.
*
* @param nmemb Number of elements
* @param size Size of the single element
* @return Pointer to the allocated block, or `NULL` if the block cannot
* be allocated
*
* @see av_mallocz()
* @see av_malloc_array()
*/
av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
After these modifications, I have been able to generate makemkv-oss.
BRs
Christophe GARNIER
More information about the ffmpeg-devel
mailing list