r265994 - libclang: fix two memory leaks (PR26292)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 12 10:54:32 PDT 2016
While useful, that would require a lot of restructuring, I think.
This file seems to mostly be dealing with C-style objects;
ExprEvalResult doesn't even have a C++ destructor. I'm not going to
dig into that, I just wanted to address this bug that someone
reported.
- Hans
On Tue, Apr 12, 2016 at 9:51 AM, David Blaikie via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Any chance of using unique_ptr, or at least a scoped cleanup device, here?
>
> On Mon, Apr 11, 2016 at 1:54 PM, Hans Wennborg via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>>
>> Author: hans
>> Date: Mon Apr 11 15:53:59 2016
>> New Revision: 265994
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=265994&view=rev
>> Log:
>> libclang: fix two memory leaks (PR26292)
>>
>> Modified:
>> cfe/trunk/tools/libclang/CIndex.cpp
>>
>> Modified: cfe/trunk/tools/libclang/CIndex.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=265994&r1=265993&r2=265994&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/tools/libclang/CIndex.cpp (original)
>> +++ cfe/trunk/tools/libclang/CIndex.cpp Mon Apr 11 15:53:59 2016
>> @@ -3571,12 +3571,13 @@ static const ExprEvalResult* evaluateExp
>> rettype = callExpr->getCallReturnType(ctx);
>>
>> if (rettype->isVectorType() || callExpr->getNumArgs() > 1) {
>> + clang_EvalResult_dispose((CXEvalResult *)result);
>> return nullptr;
>> }
>> if (rettype->isIntegralType(ctx) || rettype->isRealFloatingType())
>> {
>> if(callExpr->getNumArgs() == 1 &&
>> - !callExpr->getArg(0)->getType()->isIntegralType(ctx)){
>> -
>> + !callExpr->getArg(0)->getType()->isIntegralType(ctx)) {
>> + clang_EvalResult_dispose((CXEvalResult *)result);
>> return nullptr;
>> }
>> } else if(rettype.getAsString() == "CFStringRef") {
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list