[Mesa-dev] [PATCH] dri_glx: fix use after free report

Alex Deucher alexdeucher at gmail.com
Fri Nov 30 06:21:28 PST 2012


On Fri, Nov 30, 2012 at 2:48 AM, Dave Airlie <airlied at gmail.com> wrote:
> the critical error would use driverName.
>
> Found by internal RH coverity scan.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  src/glx/dri_glx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
> index de777fb..f42db79 100644
> --- a/src/glx/dri_glx.c
> +++ b/src/glx/dri_glx.c
> @@ -805,7 +805,6 @@ driCreateScreen(int screen, struct glx_display *priv)
>     }
>
>     psc->driver = driOpenDriver(driverName);
> -   free(driverName);
>     if (psc->driver == NULL)
>        goto cleanup;
>
> @@ -847,11 +846,15 @@ driCreateScreen(int screen, struct glx_display *priv)
>     psp->setSwapInterval = driSetSwapInterval;
>     psp->getSwapInterval = driGetSwapInterval;
>
> +   free(driverName);
> +
>     return &psc->base;
>
>  cleanup:
>     CriticalErrorMessageF("failed to load driver: %s\n", driverName);
>
> +   free(driverName);
> +
>     if (psc->driver)
>        dlclose(psc->driver);
>     glx_screen_cleanup(&psc->base);
> --
> 1.7.11.7
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list