[PATCH] fix a leak in CodeGenFunction::EmitSwitchStmt (detected by lsan)

Chandler Carruth chandlerc at gmail.com
Thu Dec 26 01:05:40 PST 2013



================
Comment at: lib/CodeGen/CGStmt.cpp:1241
@@ -1239,2 +1240,3 @@
   JumpDest SwitchExit = getJumpDestInCurrentScope("sw.epilog");
+  OwningPtr<llvm::BasicBlock> SwitchExitOwner(SwitchExit.getBlock());
 
----------------
Err, my intent with my suggestion at least was to change the private member of JumpDest to be an OwningPtr, and to add a 'takeBlock()' method adjacent to the 'getBlock()' method, and to use the latter to transfer ownership out of the OwningPtr.


http://llvm-reviews.chandlerc.com/D2472



More information about the cfe-commits mailing list