From 88c378154a95eb0c77abd187c6c7f0cac01fe481 Mon Sep 17 00:00:00 2001 From: Alan Barr Date: Thu, 11 Oct 2018 23:28:30 +0100 Subject: [PATCH] Remove redundant NULL check copy has been used before this point - so it is too late to be concerned about a NULL pointer now. This is OK as sstrdup() calls err() on NULL return from the underlying strdup() call. Raised by cppcheck. --- libi3/mkdirp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libi3/mkdirp.c b/libi3/mkdirp.c index 1fc8c346..f5281bd7 100644 --- a/libi3/mkdirp.c +++ b/libi3/mkdirp.c @@ -44,10 +44,7 @@ int mkdirp(const char *path, mode_t mode) { char *sep = strrchr(copy, '/'); if (sep == NULL) { - if (copy != NULL) { - free(copy); - copy = NULL; - } + free(copy); return -1; } *sep = '\0';