[lldb/Commands] Fix heap-use-after-free error in CommandObjectProcess
authorMed Ismail Bennani <medismail.bennani@gmail.com>
Wed, 11 Aug 2021 15:56:36 +0000 (16:56 +0100)
committerMed Ismail Bennani <medismail.bennani@gmail.com>
Wed, 11 Aug 2021 16:03:20 +0000 (17:03 +0100)
commitbe556d5131d56f285e55b0548f3b953d55d055c4
tree087d8147597388a797256004e10cbdc5b0ef1afd
parent885be620f90b87deb542258e50985512ecf6d550
[lldb/Commands] Fix heap-use-after-free error in CommandObjectProcess

This patch should fix the use-after-free error that was brought up by
the LLDB ASAN Green Dragon bot.

This is caused because the `StringRef` object was acquired too early
before being use and by the underlying memory was modified which caused
it to point to null memory.

Fetching back the string reference close to its usage location should
fix the issue.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
lldb/source/Commands/CommandObjectProcess.cpp