8 void *malloc_chk(size_t size, char *tag)
12 if((p = malloc(size)) == NULL) {
13 fprintf(stderr, "%s: cannot allocate memory\n", tag);
16 return memset(p, 0, size);
19 void *calloc_chk(size_t nmemb, size_t size, char *tag)
23 if((p = calloc(nmemb, size)) == NULL) {
24 fprintf(stderr, "%s: cannot allocate memory\n", tag);
30 char *strdup_chk(const char *s, char *tag)
35 t = malloc_chk(strlen(s) + 1, tag);