buf = calloc(huge, huge);
if (errno) perror("calloc failed");
printf("calloc(huge, huge) returned: %p\n", buf);
free(buf);
This has a flaw. errno doesn't magically get reset to zero. You should check the return value of calloc, then use errno. Checking if(errno) is not the right way to determine if there was an error.