Merge "Fix use-after-free issue caught by ASAN." into oc-dev
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index f3af46b..989fcda 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -619,11 +619,9 @@
ATRACE_BEGIN("fixup user");
FTS* fts;
FTSENT* p;
- char *argv[] = {
- (char*) create_data_user_ce_path(uuid_, user).c_str(),
- (char*) create_data_user_de_path(uuid_, user).c_str(),
- nullptr
- };
+ auto ce_path = create_data_user_ce_path(uuid_, user);
+ auto de_path = create_data_user_de_path(uuid_, user);
+ char *argv[] = { (char*) ce_path.c_str(), (char*) de_path.c_str(), nullptr };
if (!(fts = fts_open(argv, FTS_PHYSICAL | FTS_NOCHDIR | FTS_XDEV, NULL))) {
return error("Failed to fts_open");
}
@@ -952,11 +950,9 @@
for (auto user : get_known_users(uuid_)) {
FTS *fts;
FTSENT *p;
- char *argv[] = {
- (char*) create_data_user_ce_path(uuid_, user).c_str(),
- (char*) create_data_user_de_path(uuid_, user).c_str(),
- nullptr
- };
+ auto ce_path = create_data_user_ce_path(uuid_, user);
+ auto de_path = create_data_user_de_path(uuid_, user);
+ char *argv[] = { (char*) ce_path.c_str(), (char*) de_path.c_str(), nullptr };
if (!(fts = fts_open(argv, FTS_PHYSICAL | FTS_NOCHDIR | FTS_XDEV, NULL))) {
return error("Failed to fts_open");
}