diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 99249b9442c..4ef1a6e39c7 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -365,6 +365,9 @@ int main(int argc, char **argv) { // Now that we have all of the passes ready, run them. Passes.run(*M.get()); + // Delete the ofstream. + if (Out != &std::cout) + delete Out; return 0; } catch (const std::string& msg) {