From 3c70db383ca48857c3bf7ed6f607c8c87fa366d9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 7 Feb 2017 23:01:13 -0500 Subject: Add some missing perror() calls --- printf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'printf.c') diff --git a/printf.c b/printf.c index 08522db..0977d5e 100644 --- a/printf.c +++ b/printf.c @@ -466,6 +466,7 @@ static int append_literal(struct bfs_printf_directive ***tail, char **literal, b struct bfs_printf *parse_bfs_printf(const char *format, const struct colors *stderr_colors) { struct bfs_printf *command = malloc(sizeof(*command)); if (!command) { + perror("malloc()"); return NULL; } @@ -474,6 +475,10 @@ struct bfs_printf *parse_bfs_printf(const char *format, const struct colors *std struct bfs_printf_directive **tail = &command->directives; char *literal = dstralloc(0); + if (!literal) { + perror("dstralloc()"); + goto error; + } for (const char *i = format; *i; ++i) { char c = *i; -- cgit v1.2.3