Lines Matching full:nmemb
165 // Returns 0 in case of overflow of nmemb * size.
166 static int CheckSizeArgumentsOverflow(uint64_t nmemb, size_t size) {
167 const uint64_t total_size = nmemb * size;
168 if (nmemb == 0) return 1;
169 if ((uint64_t)size > WEBP_MAX_ALLOCABLE_MEMORY / nmemb) return 0;
185 void* WebPSafeMalloc(uint64_t nmemb, size_t size) {
188 if (!CheckSizeArgumentsOverflow(nmemb, size)) return NULL;
189 assert(nmemb * size > 0);
190 ptr = malloc((size_t)(nmemb * size));
191 AddMem(ptr, (size_t)(nmemb * size));
195 void* WebPSafeCalloc(uint64_t nmemb, size_t size) {
198 if (!CheckSizeArgumentsOverflow(nmemb, size)) return NULL;
199 assert(nmemb * size > 0);
200 ptr = calloc((size_t)nmemb, size);
201 AddMem(ptr, (size_t)(nmemb * size));