summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/utils/mkdir.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp
index 18d526d47..f0cc65f53 100644
--- a/src/utils/mkdir.cpp
+++ b/src/utils/mkdir.cpp
@@ -41,7 +41,7 @@
int mkdir_r(const char *pathname)
{
size_t len = static_cast<int>(strlen(pathname));
- char tmp[len+2];
+ char *tmp = new char[len + 2];
char *p;
strcpy(tmp, pathname);
@@ -79,7 +79,10 @@ int mkdir_r(const char *pathname)
continue;
}
else
+ {
+ delete tmp;
return -1;
+ }
}
#if defined WIN32
@@ -94,6 +97,7 @@ int mkdir_r(const char *pathname)
if (!(strlen(tmp) == 2 &&
!strcmp(tmp + 1, ":")))
#endif
+ delete tmp;
return -1;
}
@@ -103,6 +107,7 @@ int mkdir_r(const char *pathname)
*p = '/';
}
}
+ delete tmp;
return 0;
}