r265994 - libclang: fix two memory leaks (PR26292)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 11:29:18 PDT 2016


Didn't seem to be too invasive - r266222.

On Tue, Apr 12, 2016 at 10:54 AM, Hans Wennborg <hans at chromium.org> wrote:

> 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160413/10157c07/attachment-0001.html>


More information about the cfe-commits mailing list