提交 3fcc2684 编写于 作者: M Michael Niedermayer

Merge commit 'b284e1ff'

* commit 'b284e1ff':
  mem: do not check for negative size
Merged-by: NMichael Niedermayer <michaelni@gmx.at>
......@@ -92,7 +92,7 @@ void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
*/
av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
{
if (size <= 0 || nmemb >= INT_MAX / size)
if (!size || nmemb >= INT_MAX / size)
return NULL;
return av_malloc(nmemb * size);
}
......@@ -227,7 +227,7 @@ void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
*/
av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
{
if (size <= 0 || nmemb >= INT_MAX / size)
if (!size || nmemb >= INT_MAX / size)
return NULL;
return av_mallocz(nmemb * size);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册