This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB356227: [lldb-vscode] Fix dangling pointer in 
request_evaluate. (authored by jgorbe, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59400?vs=190764&id=190769#toc

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59400/new/

https://reviews.llvm.org/D59400

Files:
  tools/lldb-vscode/lldb-vscode.cpp


Index: tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- tools/lldb-vscode/lldb-vscode.cpp
+++ tools/lldb-vscode/lldb-vscode.cpp
@@ -965,7 +965,10 @@
       value = frame.EvaluateExpression(expression.data());
     if (value.GetError().Fail()) {
       response["success"] = llvm::json::Value(false);
-      const char *error_cstr = value.GetError().GetCString();
+      // This error object must live until we're done with the pointer returned
+      // by GetCString().
+      lldb::SBError error = value.GetError();
+      const char *error_cstr = error.GetCString();
       if (error_cstr && error_cstr[0])
         EmplaceSafeString(response, "message", std::string(error_cstr));
       else


Index: tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- tools/lldb-vscode/lldb-vscode.cpp
+++ tools/lldb-vscode/lldb-vscode.cpp
@@ -965,7 +965,10 @@
       value = frame.EvaluateExpression(expression.data());
     if (value.GetError().Fail()) {
       response["success"] = llvm::json::Value(false);
-      const char *error_cstr = value.GetError().GetCString();
+      // This error object must live until we're done with the pointer returned
+      // by GetCString().
+      lldb::SBError error = value.GetError();
+      const char *error_cstr = error.GetCString();
       if (error_cstr && error_cstr[0])
         EmplaceSafeString(response, "message", std::string(error_cstr));
       else
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to