summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author George Burgess IV <gbiv@google.com> 2022-06-28 11:21:43 -0700
committer George Burgess IV <gbiv@google.com> 2022-06-28 11:23:21 -0700
commit4645f98185b6f1964ca95af9879f9bdd988ece9a (patch)
tree17903e7df4e0e6290e3192200e45e5416c001db0
parent051c9a15af33d9327860aa3046f700832cb0d55d (diff)
make: fix memory leak
`info->symlink_target` is a `std::string`. This `strdup` therefore leaks memory. Just use `std::string::operator=(const char *)` instead. Bug: 206470603 Test: TreeHugger Change-Id: I71bcaec583c7d429b4d09522cc5eeb2ced009007
-rw-r--r--tools/build-runfiles.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/build-runfiles.cc b/tools/build-runfiles.cc
index d92e663b7e..b6197f0708 100644
--- a/tools/build-runfiles.cc
+++ b/tools/build-runfiles.cc
@@ -147,7 +147,7 @@ class RunfilesCreator {
info->type = FILE_TYPE_REGULAR;
} else {
info->type = FILE_TYPE_SYMLINK;
- info->symlink_target = strdup(target);
+ info->symlink_target = target;
}
FileInfo parent_info;