r265994 - libclang: fix two memory leaks (PR26292)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 09:51:49 PDT 2016


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


More information about the cfe-commits mailing list