summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--direct-append.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/direct-append.c b/direct-append.c
index af7efb4..2b782ff 100644
--- a/direct-append.c
+++ b/direct-append.c
@@ -61,6 +61,10 @@ int main(int argc, char *argv[])
}
str = malloc(n_chars * sizeof(char));
+ if (!str) {
+ perror("malloc");
+ exit(EXIT_FAILURE);
+ }
for (i = 0; i < n_chars; i++)
str[i] = get_random_printable_char();