diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-12-17 16:27:23 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-12-17 16:27:23 -0800 |
| commit | 484e1e33da7477b7278c9a3e9da878f0375dd75b (patch) | |
| tree | 892979f8bf65fd9a1366c040fa4a090968fcaecf /utils.c | |
| parent | 40be243004b095fe15bb2ece176692f8354cdf45 (diff) | |
Memory allocation failure checks, and a simpler new() function
Diffstat (limited to 'utils.c')
| -rw-r--r-- | utils.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -172,5 +172,13 @@ size_t unescape_string(char *dest, const char *src, size_t bufsize) #undef PUT } +void *memcheck(void *p) +{ + if (p == NULL) { + fprintf(stderr, "memory allocation failure\n"); + _exit(1); + } + return p; +} // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1 |
