1
diff --git a/ccache.c b/ccache.c
2
index 8ed9892..38775cf 100644
5
@@ -144,7 +144,9 @@ static const char *tmp_string(void)
6
gethostname(hostname, sizeof(hostname)-1);
8
hostname[sizeof(hostname)-1] = 0;
9
- asprintf(&ret, "%s.%u", hostname, (unsigned)getpid());
10
+ if (asprintf(&ret, "%s.%u", hostname, (unsigned)getpid()) == -1) {
11
+ fatal("could not allocate tmp_string");
16
diff --git a/stats.c b/stats.c
17
index ddaf768..593cd15 100644
20
@@ -91,7 +91,7 @@ static void write_stats(int fd, unsigned counters[STATS_END])
21
if (len >= (int)sizeof(buf)-1) fatal("stats too long?!");
23
lseek(fd, 0, SEEK_SET);
24
- write(fd, buf, len);
25
+ if (write(fd, buf, len) == -1) fatal("could not write stats");
29
diff --git a/util.c b/util.c
30
index 6056d36..5b28d14 100644
33
@@ -372,7 +372,9 @@ void x_asprintf(char **ptr, const char *format, ...)
37
- vasprintf(ptr, format, ap);
38
+ if (vasprintf(ptr, format, ap) == -1) {
39
+ fatal("out of memory in x_asprintf");
43
if (!ptr) fatal("out of memory in x_asprintf");