ecore evas drm - fix multi-dlopening of lib into symbol space
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 5 Aug 2019 12:48:14 +0000 (13:48 +0100)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 12 Aug 2019 07:20:56 +0000 (16:20 +0900)
only load libglapi once... not multiple times by storing static ptr to
lib handle.

fix CID 1402692

src/modules/ecore_evas/engines/drm/ecore_evas_drm.c

index 6988ae8..97d6fa1 100644 (file)
@@ -1138,7 +1138,9 @@ ecore_evas_drm_new_internal(const char *device, unsigned int parent EINA_UNUSED,
 EAPI Ecore_Evas *
 ecore_evas_gl_drm_new_internal(const char *device, unsigned int parent EINA_UNUSED, int x, int y, int w, int h)
 {
-   dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
+   static void *libglapi = NULL;
+
+   if (!libglapi) libglapi = dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
    if (dlerror()) return NULL;
 
    return _ecore_evas_new_internal(device, x, y, w, h, EINA_TRUE);