mem: Do not check unsigned values for negative size

This commit is contained in:
Diego Biurrun 2013-09-04 12:28:01 +02:00
parent b634b36fce
commit c3e6e8f06c

View File

@ -138,7 +138,7 @@ void *av_realloc(void *ptr, size_t size)
void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
{
if (size <= 0 || nmemb >= INT_MAX / size)
if (!size || nmemb >= INT_MAX / size)
return NULL;
return av_realloc(ptr, nmemb * size);
}
@ -147,9 +147,9 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
{
void **ptrptr = ptr;
void *ret;
if (size <= 0 || nmemb >= INT_MAX / size)
if (!size || nmemb >= INT_MAX / size)
return AVERROR(ENOMEM);
if (nmemb <= 0) {
if (!nmemb) {
av_freep(ptr);
return 0;
}