egl: fix deadlock in malloc error path
authorEric Engestrom <eric.engestrom@intel.com>
Mon, 26 Aug 2019 14:29:49 +0000 (15:29 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Tue, 3 Sep 2019 23:10:18 +0000 (00:10 +0100)
Fixes: cb0980e69aa921af7086 ("egl: move alloc & init out of _eglBuiltInDriver{DRI2,Haiku}")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/egl/main/egldriver.c

index e719b19a63f383d082b44e541d7103a35f06ab95..0d8919aa0e1cce345a6780db81de2e974ae2b05e 100644 (file)
@@ -56,8 +56,10 @@ _eglGetDriver(void)
 
    if (!_eglDriver) {
       _eglDriver = calloc(1, sizeof(*_eglDriver));
-      if (!_eglDriver)
+      if (!_eglDriver) {
+         mtx_unlock(&_eglModuleMutex);
          return NULL;
+      }
       _eglInitDriver(_eglDriver);
    }