diff options
author | Xinliang David Li <davidxl@google.com> | 2016-05-20 04:52:27 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2016-05-20 04:52:27 +0000 |
commit | 879099e2a5a07bcda897cdacad2e75d7fd03374b (patch) | |
tree | c2ad42ade2a5fb2a37ab595bda0ea43ddff4885f /lib/profile/InstrProfilingFile.c | |
parent | 083310370fd2fbaef9b721a5eafb9ee9a35bc3f1 (diff) |
[profile] Remove anther malloc use
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270181 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfilingFile.c')
-rw-r--r-- | lib/profile/InstrProfilingFile.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/profile/InstrProfilingFile.c b/lib/profile/InstrProfilingFile.c index f18a48507..a2057e83a 100644 --- a/lib/profile/InstrProfilingFile.c +++ b/lib/profile/InstrProfilingFile.c @@ -14,6 +14,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifdef _MSC_VER +/* For _alloca */ +#endif +#include <malloc.h> + #define UNCONST(ptr) ((void *)(uintptr_t)(ptr)) @@ -83,10 +88,9 @@ static void truncateCurrentFile(void) { /* Create the directory holding the file, if needed. */ if (strchr(Filename, '/') || strchr(Filename, '\\')) { - char *Copy = malloc(strlen(Filename) + 1); + char *Copy = (char *)COMPILER_RT_ALLOCA(strlen(Filename) + 1); strcpy(Copy, Filename); __llvm_profile_recursive_mkdir(Copy); - free(Copy); } /* Truncate the file. Later we'll reopen and append. */ |