MCPcopy Index your code
hub / github.com/git/git / do_xmallocz

Function do_xmallocz

wrapper.c:79–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79static void *do_xmallocz(size_t size, int gentle)
80{
81 void *ret;
82 if (unsigned_add_overflows(size, 1)) {
83 if (gentle) {
84 error("Data too large to fit into virtual memory space.");
85 return NULL;
86 } else
87 die("Data too large to fit into virtual memory space.");
88 }
89 ret = do_xmalloc(size + 1, gentle);
90 if (ret)
91 ((char*)ret)[size] = 0;
92 return ret;
93}
94
95void *xmallocz(size_t size)
96{

Callers 2

xmalloczFunction · 0.85
xmallocz_gentlyFunction · 0.85

Calls 3

errorFunction · 0.85
do_xmallocFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected