Fix use after free issue found with ASAN build
The android_get* functions aren't needed and caused a read after
free issue so remove.
Bug: 118375731
Test: manual - ASAN build, run OpenGL app.
Change-Id: Ifaacd95c946a9838147a16753010feec0875d594
diff --git a/opengl/libs/EGL/egl_layers.cpp b/opengl/libs/EGL/egl_layers.cpp
index 6900b8b..e4906e0 100644
--- a/opengl/libs/EGL/egl_layers.cpp
+++ b/opengl/libs/EGL/egl_layers.cpp
@@ -145,7 +145,7 @@
std::string LayerLoader::GetDebugLayers() {
// Layers can be specified at the Java level in GraphicsEnvironemnt
// gpu_debug_layers = layer1:layer2:layerN
- std::string debug_layers = android_getDebugLayers();
+ std::string debug_layers = android::GraphicsEnv::getInstance().getDebugLayers();
if (debug_layers.empty()) {
// Only check system properties if Java settings are empty
@@ -339,7 +339,9 @@
// Load the layers in reverse order so we start with the driver's entrypoint and work our way up
for (int32_t i = layers.size() - 1; i >= 0; i--) {
// Check each layer path for the layer
- std::vector<std::string> paths = android::base::Split(android_getLayerPaths(), ":");
+ std::vector<std::string> paths =
+ android::base::Split(android::GraphicsEnv::getInstance().getLayerPaths().c_str(),
+ ":");
if (!system_path.empty()) {
// Prepend the system paths so they override other layers