diff options
author | Marvin Borner | 2023-05-17 00:19:14 +0200 |
---|---|---|
committer | Marvin Borner | 2023-05-17 00:24:37 +0200 |
commit | f640ceee89836b56ac95c4eb1b0a43d1171c3354 (patch) | |
tree | 9deab5538634c983794a78e04b8e2cd5255711ab /src/main.c | |
parent | ae597603952e3e329eecc25512606a7fa85ea0ec (diff) |
General improvements
(nothing special, mainly cleanup and docs)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -12,7 +12,6 @@ #include <tree.h> #include <parse.h> #include <build.h> -#include <free.h> // automatically generated using gengetopt #include "cmdline.h" @@ -25,7 +24,7 @@ static char *read_stdin(void) size_t size = 1; char *string = malloc(sizeof(char) * BUF_SIZE); if (!string) - return 0; + fatal("out of memory!\n"); string[0] = '\0'; while (fgets(buffer, BUF_SIZE, stdin)) { char *old = string; @@ -57,6 +56,8 @@ static char *read_file(const char *path) fseek(f, 0, SEEK_SET); char *string = malloc(fsize + 1); + if (!string) + fatal("out of memory!\n"); int ret = fread(string, fsize, 1, f); fclose(f); |