xwayland: fix a realloc OOM error case
Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
bd5fe7593f
commit
7c25439f0d
|
@ -196,7 +196,7 @@ xwl_glamor_egl_supports_device_probing(void)
|
||||||
static void **
|
static void **
|
||||||
xwl_glamor_egl_get_devices(int *num_devices)
|
xwl_glamor_egl_get_devices(int *num_devices)
|
||||||
{
|
{
|
||||||
EGLDeviceEXT *devices;
|
EGLDeviceEXT *devices, *tmp;
|
||||||
Bool ret;
|
Bool ret;
|
||||||
int drm_dev_count = 0;
|
int drm_dev_count = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -233,7 +233,11 @@ xwl_glamor_egl_get_devices(int *num_devices)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
*num_devices = drm_dev_count;
|
*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;
|
return devices;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue