Merge "Actually correctly call vector::erase after remove_if."
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 46cd60c..317f0d2 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -130,7 +130,8 @@
     // We have historically supported ':' as well as ' ' in LD_PRELOAD.
     g_ld_preload_names = android::base::Split(path, " :");
     g_ld_preload_names.erase(std::remove_if(g_ld_preload_names.begin(), g_ld_preload_names.end(),
-                                            [](const std::string& s) { return s.empty(); }));
+                                            [](const std::string& s) { return s.empty(); }),
+                             g_ld_preload_names.end());
   }
 }