Fix a memory leak

Analyzer complaint:
frameworks/compile/slang/slang.cpp:336:12: warning: Potential leak of
memory pointed to by 'OS'

This is a bit tricky: llvm::tool_output_file's ctor might write a
failure value to EC. If so, we'd take the `if (EC) return false;`
branch in Slang::setOutput, and fail to free `OS`.

Using a unique_ptr instead fixes all of our problems.

This also removes a nullptr check; `new` without `std::nothrow` can't
return null, so the null check was unnecessary.

Bug: None
Test: Ran the static analyzer. No complaints about leaky memory.
Change-Id: I22c865ea4ef8caf1d8c3b14939a6d28850f587c4
1 file changed