Browse Source

mem: do not check for negative size

size_t is guaranteed to be unsigned

Signed-off-by: Anton Khirnov <anton@khirnov.net>
tags/n2.1
Vittorio Giovara Anton Khirnov 12 years ago
parent
commit
b284e1ffe3
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavutil/mem.h

+ 2
- 2
libavutil/mem.h View File

@@ -91,7 +91,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);
}
@@ -204,7 +204,7 @@ void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
*/
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);
}


Loading…
Cancel
Save