[PATCH] D158254: Fixing the memory leak using split() instead of strtok
Abhina Sree via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 22 12:26:46 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc3c8f16fc32c: Fixing the memory leak using split() instead of strtok (authored by hchilama, committed by abhina.sreeskantharajan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158254/new/
https://reviews.llvm.org/D158254
Files:
clang/lib/Driver/ToolChains/ZOS.cpp
Index: clang/lib/Driver/ToolChains/ZOS.cpp
===================================================================
--- clang/lib/Driver/ToolChains/ZOS.cpp
+++ clang/lib/Driver/ToolChains/ZOS.cpp
@@ -188,11 +188,10 @@
CmdArgs.push_back(
Args.MakeArgString("//'" + LEHLQ + ".SCEELIB(CELQS003)'"));
} else {
- char *ld_side_deck = strdup(ld_env_var.str().c_str());
- ld_side_deck = strtok(ld_side_deck, ":");
- while (ld_side_deck != nullptr) {
- CmdArgs.push_back(ld_side_deck);
- ld_side_deck = strtok(nullptr, ":");
+ SmallVector<StringRef> ld_side_deck;
+ ld_env_var.split(ld_side_deck, ":");
+ for (StringRef ld_loc : ld_side_deck) {
+ CmdArgs.push_back((ld_loc.str()).c_str());
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158254.552471.patch
Type: text/x-patch
Size: 772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230822/8a012429/attachment.bin>
More information about the cfe-commits
mailing list