Page MenuHomePhabricator

[lldb-vscode] Fix dangling pointer in request_evaluate.

Authored by jgorbe on Mar 14 2019, 6:05 PM.



SBError::GetCString() returns a pointer to a string owned by the SBError
object. The code here was calling GetCString on a temporary and using
the returned pointer after the temporary was destroyed.

Diff Detail


Event Timeline

jgorbe created this revision.Mar 14 2019, 6:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2019, 6:05 PM

Another option would be to just assign it to a std::string, but this is fine too.

zturner accepted this revision.Mar 14 2019, 6:28 PM
This revision is now accepted and ready to land.Mar 14 2019, 6:28 PM

I considered assigning it to a std::string, but GetCString() can return a null pointer and I'm not sure you can construct a std::string directly from that.

This revision was automatically updated to reflect the committed changes.