[Mesa-stable] [Mesa-dev] [PATCH 2/2] egl/wayland: plug memory leak in drm_handle_device()
Eric Engestrom
eric.engestrom at intel.com
Tue Nov 27 11:58:40 UTC 2018
On Tuesday, 2018-11-27 11:39:42 +0000, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> As we fail to open the node, we leak the node/device name.
>
> Cc: mesa-stable at lists.freedesktop.org
> Cc: Eric Engestrom <eric.engestrom at intel.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> src/egl/drivers/dri2/platform_wayland.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index b05f5363163..df25a482908 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -1125,6 +1125,8 @@ drm_handle_device(void *data, struct wl_drm *drm, const char *device)
>
> dri2_dpy->fd = loader_open_device(dri2_dpy->device_name);
> if (dri2_dpy->fd == -1) {
> + free(dri2_dpy->device_name);
> + dri2_dpy->device_name = NULL:
> _eglLog(_EGL_WARNING, "wayland-egl: could not open %s (%s)",
> dri2_dpy->device_name, strerror(errno));
You'll want to free *after* printing device_name ;)
With that:
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
> return;
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-stable
mailing list