Merge "Fix: null name is added when using android_set_process_profiles" am: 2d0decdc85 am: 0c869f2b0c am: bea81911e6 am: 78a0f6eaa3 am: 3cf4f6fd34
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2068869
Change-Id: Ia0b8fc490b25d57896365ec90acb4921f7e445aa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index edda414..e3a80e9 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -166,7 +166,8 @@
// https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3574427/5/src/linux/android.rs#12
extern "C" bool android_set_process_profiles(uid_t uid, pid_t pid, size_t num_profiles,
const char* profiles[]) {
- std::vector<std::string> profiles_(num_profiles);
+ std::vector<std::string> profiles_;
+ profiles_.reserve(num_profiles);
for (size_t i = 0; i < num_profiles; i++) {
profiles_.emplace_back(profiles[i]);
}