version 1.28, 2013/05/17 00:13:14 |
version 1.29, 2014/01/04 17:50:55 |
|
|
fatal("xmalloc: zero size"); |
fatal("xmalloc: zero size"); |
ptr = malloc(size); |
ptr = malloc(size); |
if (ptr == NULL) |
if (ptr == NULL) |
fatal("xmalloc: out of memory (allocating %lu bytes)", (u_long) size); |
fatal("xmalloc: out of memory (allocating %zu bytes)", size); |
return ptr; |
return ptr; |
} |
} |
|
|
|
|
fatal("xcalloc: nmemb * size > SIZE_T_MAX"); |
fatal("xcalloc: nmemb * size > SIZE_T_MAX"); |
ptr = calloc(nmemb, size); |
ptr = calloc(nmemb, size); |
if (ptr == NULL) |
if (ptr == NULL) |
fatal("xcalloc: out of memory (allocating %lu bytes)", |
fatal("xcalloc: out of memory (allocating %zu bytes)", |
(u_long)(size * nmemb)); |
size * nmemb); |
return ptr; |
return ptr; |
} |
} |
|
|
|
|
else |
else |
new_ptr = realloc(ptr, new_size); |
new_ptr = realloc(ptr, new_size); |
if (new_ptr == NULL) |
if (new_ptr == NULL) |
fatal("xrealloc: out of memory (new_size %lu bytes)", |
fatal("xrealloc: out of memory (new_size %zu bytes)", |
(u_long) new_size); |
new_size); |
return new_ptr; |
return new_ptr; |
} |
} |
|
|