aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mem.h
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2013-10-25 16:41:12 +0200
committerAnton Khirnov <anton@khirnov.net>2013-10-26 09:05:56 +0200
commitb284e1ffe343d6697fb950d1ee517bafda8a9844 (patch)
tree48c156c5e722eef842929582f72f8f7125e603e4 /libavutil/mem.h
parent4e326ec76991667c3cb0130c423e9818ad7f2a20 (diff)
downloadffmpeg-b284e1ffe343d6697fb950d1ee517bafda8a9844.tar.gz
mem: do not check for negative size
size_t is guaranteed to be unsigned Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavutil/mem.h')
-rw-r--r--libavutil/mem.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h
index f51682bb08..99dc4cc156 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -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);
}