summaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2014-11-14 22:23:57 +0000
committerEric Fiselier <eric@efcs.ca>2014-11-14 22:23:57 +0000
commit017e1aab88c002bac7655e907b74bacea6845b08 (patch)
tree1d135345dbadd31e87c0d191494a192a5d028d08 /src/string.cpp
parent1383dc5bd076263bb1c5750741041213af877b56 (diff)
Initialize pointer in string conversion helpers to prevent MSAN diagnostic.
Since the initialization of the pointer happens across the libc library boundry MSAN will not know the pointer was initialized. This fixes MSAN failures in test/strings/string.conversions. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222052 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/string.cpp b/src/string.cpp
index fdaad2927..febc53209 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -63,7 +63,7 @@ inline
V
as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f)
{
- typename S::value_type* ptr;
+ typename S::value_type* ptr = nullptr;
const typename S::value_type* const p = str.c_str();
typename remove_reference<decltype(errno)>::type errno_save = errno;
errno = 0;
@@ -180,7 +180,7 @@ inline
V
as_float_helper(const string& func, const S& str, size_t* idx, F f )
{
- typename S::value_type* ptr;
+ typename S::value_type* ptr = nullptr;
const typename S::value_type* const p = str.c_str();
typename remove_reference<decltype(errno)>::type errno_save = errno;
errno = 0;