[cfe-commits] r161686 - in /cfe/trunk: include/clang/AST/Stmt.h lib/AST/Stmt.cpp lib/Sema/SemaStmt.cpp

Chad Rosier mcrosier at apple.com
Fri Aug 10 14:07:28 PDT 2012


Committed revision 161698.  Thanks, Dmitri.

 Chad

On Aug 10, 2012, at 12:52 PM, Dmitri Gribenko wrote:

> On Fri, Aug 10, 2012 at 12:13 PM, Chad Rosier <mcrosier at apple.com> wrote:
>> +  Clobbers = new (C) std::string[NumClobbers];
> 
> std::string is calling plain new[] internally to allocate memory for
> characters.  Since destructors will not be called (because std::string
> itself is allocated on ASTContext's allocator), this is a memory leak.
> 
> You might want to use ArrayRef<StringRef> where memory for baking
> array and strings is allocated on ASTContext's allocator.
> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-commits mailing list