summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/profile/InstrProfilingBuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfilingBuffer.c')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingBuffer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingBuffer.c b/compiler-rt/lib/profile/InstrProfilingBuffer.c
index e587932da0a..620c1755baa 100644
--- a/compiler-rt/lib/profile/InstrProfilingBuffer.c
+++ b/compiler-rt/lib/profile/InstrProfilingBuffer.c
@@ -79,6 +79,10 @@ int __llvm_profile_write_buffer_internal(
/* Create the header. */
__llvm_profile_header Header;
+
+ if (!DataSize)
+ return 0;
+
Header.Magic = __llvm_profile_get_magic();
Header.Version = __llvm_profile_get_version();
Header.DataSize = DataSize;
OpenPOWER on IntegriCloud