[lld] r194545 - [PECOFF] Fix use-after-return.

Sean Silva silvas at purdue.edu
Tue Nov 12 18:31:20 PST 2013


Sanitizers?

There have been a couple of these sorts of bugs recently... we really ought
to have some sanitizer bots...

-- Sean Silva


On Tue, Nov 12, 2013 at 9:21 PM, Rui Ueyama <ruiu at google.com> wrote:

> Author: ruiu
> Date: Tue Nov 12 20:21:51 2013
> New Revision: 194545
>
> URL: http://llvm.org/viewvc/llvm-project?rev=194545&view=rev
> Log:
> [PECOFF] Fix use-after-return.
>
> Modified:
>     lld/trunk/lib/Driver/WinLinkDriver.cpp
>
> Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=194545&r1=194544&r2=194545&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
> +++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Nov 12 20:21:51 2013
> @@ -842,7 +842,7 @@ WinLinkDriver::parse(int argc, const cha
>
>      case OPT_INPUT:
>        inputElements.push_back(std::unique_ptr<InputElement>(
> -          new PECOFFFileNode(ctx, inputArg->getValue())));
> +          new PECOFFFileNode(ctx,
> ctx.allocateString(inputArg->getValue()))));
>        break;
>
>  #define DEFINE_BOOLEAN_FLAG(name, setter)       \
> @@ -892,9 +892,11 @@ WinLinkDriver::parse(int argc, const cha
>    // start with a hypen or a slash. This is not compatible with link.exe
>    // but useful for us to test lld on Unix.
>    if (llvm::opt::Arg *dashdash = parsedArgs->getLastArg(OPT_DASH_DASH)) {
> -    for (const StringRef value : dashdash->getValues())
> -      inputElements.push_back(
> -          std::unique_ptr<InputElement>(new PECOFFFileNode(ctx, value)));
> +    for (const StringRef value : dashdash->getValues()) {
> +      std::unique_ptr<InputElement> elem(
> +          new PECOFFFileNode(ctx, ctx.allocateString(value)));
> +      inputElements.push_back(std::move(elem));
> +    }
>    }
>
>    // Add the libraries specified by /defaultlib unless they are already
> added
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131112/af2fcaf5/attachment.html>


More information about the llvm-commits mailing list