[llvm] r192103 - Windows/Process.inc: Fix for +Asserts. &Buf[0] is not guaranteed if size is zero.

NAKAMURA Takumi geek4civic at gmail.com
Mon Oct 7 08:33:30 PDT 2013


Author: chapuni
Date: Mon Oct  7 10:33:30 2013
New Revision: 192103

URL: http://llvm.org/viewvc/llvm-project?rev=192103&view=rev
Log:
Windows/Process.inc: Fix for +Asserts. &Buf[0] is not guaranteed if size is zero.

Modified:
    llvm/trunk/lib/Support/Windows/Process.inc

Modified: llvm/trunk/lib/Support/Windows/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Process.inc?rev=192103&r1=192102&r2=192103&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Process.inc (original)
+++ llvm/trunk/lib/Support/Windows/Process.inc Mon Oct  7 10:33:30 2013
@@ -161,7 +161,7 @@ Optional<std::string> Process::GetEnv(St
   SmallVector<wchar_t, MAX_PATH> Buf;
   size_t Size = MAX_PATH;
   do {
-    Buf.reserve(Size);
+    Buf.resize(Size);
     Size = GetEnvironmentVariableW(&NameUTF16[0], &Buf[0], Buf.capacity());
     if (Size == 0)
       return None;





More information about the llvm-commits mailing list