diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2018-10-16 10:37:16 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2018-10-16 10:37:16 +1000 |
commit | 7c25439f0db4c20a4eab4ed44262eb396305f58a (patch) | |
tree | 38e1b9a3dc19d26c6a830fc62bcd3e05bd11a28a | |
parent | bd5fe7593fd0df236f3b2be1f062166ddba7d67c (diff) |
xwayland: fix a realloc OOM error case
Found by coverity
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | hw/xwayland/xwayland-glamor-eglstream.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c index 9950be94d..c62c0d2ac 100644 --- a/hw/xwayland/xwayland-glamor-eglstream.c +++ b/hw/xwayland/xwayland-glamor-eglstream.c @@ -196,7 +196,7 @@ xwl_glamor_egl_supports_device_probing(void) static void ** xwl_glamor_egl_get_devices(int *num_devices) { - EGLDeviceEXT *devices; + EGLDeviceEXT *devices, *tmp; Bool ret; int drm_dev_count = 0; int i; @@ -233,7 +233,11 @@ xwl_glamor_egl_get_devices(int *num_devices) goto error; *num_devices = drm_dev_count; - devices = realloc(devices, sizeof(EGLDeviceEXT) * drm_dev_count); + tmp = realloc(devices, sizeof(EGLDeviceEXT) * drm_dev_count); + if (!tmp) + goto error; + + devices = tmp; return devices; |