You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scrcpy/app/src/util/memory.c

15 lines
259 B
C

#include "memory.h"
#include <stdlib.h>
#include <errno.h>
void *
sc_allocarray(size_t nmemb, size_t size) {
size_t bytes;
if (__builtin_mul_overflow(nmemb, size, &bytes)) {
errno = ENOMEM;
return NULL;
}
return malloc(bytes);
}