mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
15 lines
259 B
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);
|
||
|
|
}
|