]> git.sur5r.net Git - i3/i3/commitdiff
Remove redundant NULL check
authorAlan Barr <a.barr@outlook.com>
Thu, 11 Oct 2018 22:28:30 +0000 (23:28 +0100)
committerAlan Barr <a.barr@outlook.com>
Sat, 13 Oct 2018 16:41:50 +0000 (17:41 +0100)
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

index 1fc8c34607222ad381b269fad2fed20e1ad81bdc..f5281bd74164c5e1268a2cd3f3925ff1a9d28063 100644 (file)
@@ -44,10 +44,7 @@ int mkdirp(const char *path, mode_t mode) {
 
     char *sep = strrchr(copy, '/');
     if (sep == NULL) {
 
     char *sep = strrchr(copy, '/');
     if (sep == NULL) {
-        if (copy != NULL) {
-            free(copy);
-            copy = NULL;
-        }
+        free(copy);
         return -1;
     }
     *sep = '\0';
         return -1;
     }
     *sep = '\0';