From 766d926c17996960cb1374b9bb0bf1bff0b2edf9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 27 Feb 2018 11:13:46 -0800 Subject: [PATCH] ccon: Check for failed strdup in mkdir_all --- ccon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ccon.c b/ccon.c index 3d2da9a..a04383d 100644 --- a/ccon.c +++ b/ccon.c @@ -2610,6 +2610,11 @@ static int mkdir_all(const char *path, mode_t mode) if (stat(path, &buf) == -1) { if (errno == ENOENT) { path_copy = strdup(path); + if (path_copy == NULL) { + PERROR("strdup"); + err = -1; + goto cleanup; + } dir = dirname(path_copy); if (mkdir_all(dir, mode) == -1) { err = -1;