[cfe-commits] r144379 - in /cfe/trunk: test/Misc/serialized-diags.c tools/libclang/CXLoadedDiagnostic.cpp

Ted Kremenek kremenek at apple.com
Fri Nov 11 07:19:45 PST 2011


On Nov 11, 2011, at 7:15 AM, NAKAMURA Takumi wrote:

> 2011/11/12 Ted Kremenek <kremenek at apple.com>:
>> I think we should instead fix CXLoadedDiagnosticSetImpl::makeString() to add a null terminator.  Your patch actually introduces a memory leak since we don't ever explicitly release these CXStrings (and expect them to get released when the CXLoadedDiagnosticSetImpl object is destroyed).
> 
> Ted, I see. Thanks to point me out.
> 
> Explanation: I took simpler patch. I should've expanded makeString() ;)
> 
> ...Takumi

No problem.  I'm actually editing the code right now, so I'll go ahead and fix it.  Thanks for pointing out the null character issue though.

BTW, I was mistaken that this was always a memory leak.  Clients processing the fixit string (and called clang_disposeCXString) would release the string, but then the string couldn't be used a second time.



More information about the cfe-commits mailing list