[Mesa-dev] [PATCH] egl/dri2/android: free driver_name in dri2_initialize_android error path

Chad Versace chad.versace at linux.intel.com
Tue Jan 28 10:22:28 PST 2014


On Tue, Jan 28, 2014 at 11:59:14AM +0000, Emil Velikov wrote:
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  src/egl/drivers/dri2/platform_android.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
> index 4a201c8..e149a4b 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -722,6 +722,8 @@ cleanup_screen:
>     dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
>  cleanup_driver:
>     dlclose(dri2_dpy->driver);
> +cleanup_driver_name:
> +   free(dri2_dpy->driver_name);
>  cleanup_device:
>     close(dri2_dpy->fd);
>  cleanup_display:
> -- 
> 1.8.5.2

The driver name still leaks when this failure is hit:

   if (!dri2_load_driver(dpy)) {
      err = "DRI2: failed to load driver";
      goto cleanup_device;
   }

To fix the leak, I think that failure block should goto
cleanup_driver_name.


More information about the mesa-dev mailing list