From 3d0d3e99c0335b94fa41fafce6d0fb3fedb07f75 Mon Sep 17 00:00:00 2001 From: zhangjincheng Date: Tue, 25 Apr 2023 15:41:04 +0800 Subject: opengl: fix resource leak when dlsym failed Bug: 280001152 Test: coverity test Change-Id: Id189b304e791ec60c2661f941b0f0d480cf15227 Signed-off-by: zhangjincheng --- opengl/libs/EGL/egl_angle_platform.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opengl/libs/EGL/egl_angle_platform.cpp b/opengl/libs/EGL/egl_angle_platform.cpp index d38f2eff01..c0ead5096f 100644 --- a/opengl/libs/EGL/egl_angle_platform.cpp +++ b/opengl/libs/EGL/egl_angle_platform.cpp @@ -145,6 +145,7 @@ bool initializeAnglePlatform(EGLDisplay dpy) { if (!angleGetDisplayPlatform) { ALOGE("dlsym lookup of ANGLEGetDisplayPlatform in libEGL_angle failed!"); + dlclose(so); return false; } @@ -155,6 +156,7 @@ bool initializeAnglePlatform(EGLDisplay dpy) { if (!((angleGetDisplayPlatform)(dpy, g_PlatformMethodNames, g_NumPlatformMethods, nullptr, &platformMethods))) { ALOGE("ANGLEGetDisplayPlatform call failed!"); + dlclose(so); return false; } if (platformMethods) { -- cgit v1.2.3-59-g8ed1b