chiark / gitweb /
mkdir: do not use alloca() in a loop
authorKay Sievers <kay@vrfy.org>
Tue, 17 Apr 2012 12:43:28 +0000 (14:43 +0200)
committerKay Sievers <kay@vrfy.org>
Tue, 17 Apr 2012 14:05:28 +0000 (16:05 +0200)
src/shared/mkdir.c

index fef674c..b102af7 100644 (file)
@@ -84,10 +84,12 @@ int mkdir_parents(const char *path, mode_t mode) {
                 if (*p == 0)
                         return 0;
 
-                if (!(t = strndupa(path, e - path)))
+                t = strndup(path, e - path);
+                if (!t)
                         return -ENOMEM;
 
                 r = label_mkdir(t, mode);
+                free(t);
 
                 if (r < 0 && errno != EEXIST)
                         return -errno;