From 6e36d9094230b3ec4c757a372c16ef0d7d386ad1 Mon Sep 17 00:00:00 2001
From: David Bodnar <bdvd001@gmail.com>
Date: Tue, 18 Jun 2019 21:37:23 +0200
Subject: [PATCH] SystemTools: Reduce scope of 'buf' variable in
 CollapseFullPath

---
 SystemTools.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SystemTools.cxx b/SystemTools.cxx
index 2135913f..4a4ace98 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -3411,9 +3411,9 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path,
                                           const char* in_base)
 {
   // Use the current working directory as a base path.
-  char buf[2048];
   const char* res_in_base = in_base;
   if (!res_in_base) {
+    char buf[2048];
     if (const char* cwd = Getcwd(buf, 2048)) {
       res_in_base = cwd;
     } else {
-- 
GitLab