From 4645f98185b6f1964ca95af9879f9bdd988ece9a Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 28 Jun 2022 11:21:43 -0700 Subject: [PATCH] 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 --- tools/build-runfiles.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;