diff options
author | Diego Biurrun <diego@biurrun.de> | 2013-09-04 12:28:01 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2013-09-05 12:38:43 +0200 |
commit | c3e6e8f06c42499bd020fd0b37f9542150e6067b (patch) | |
tree | 818c7a2e849c3ee9ea9e24853d6772fa2b8596e8 | |
parent | b634b36fcebfe16b837b6c4044f5d5cb99a75040 (diff) | |
download | ffmpeg-c3e6e8f06c42499bd020fd0b37f9542150e6067b.tar.gz |
mem: Do not check unsigned values for negative size
-rw-r--r-- | libavutil/mem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c index b4a190ac21..5f64f56a0d 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -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; } |