[Mesa-dev] [PATCH] st/vdpau: correct null check

Christian König deathsimple at vodafone.de
Wed Mar 30 07:26:32 UTC 2016


Am 30.03.2016 um 08:13 schrieb Thomas Hindoe Paaboel Andersen:
> The null check of result was the wrong way around. Also, move memset
> and dereference of result after the null check.
> ---
>   src/gallium/state_trackers/vdpau/surface.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

Good catch, patch is Reviewed-by: Christian König <christian.koenig at amd.com>

Do you have commit access or should I push it?

Thanks,
Christian.

>
> diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
> index 0550141..d418d56 100644
> --- a/src/gallium/state_trackers/vdpau/surface.c
> +++ b/src/gallium/state_trackers/vdpau/surface.c
> @@ -426,18 +426,18 @@ VdpStatus vlVdpVideoSurfaceDMABuf(VdpVideoSurface surface,
>   
>      struct pipe_surface *surf;
>   
> -   memset(result, 0, sizeof(*result));
> -   result->handle = -1;
> -
>      if (!p_surf)
>         return VDP_STATUS_INVALID_HANDLE;
>   
>      if (plane > 3)
>         return VDP_STATUS_INVALID_VALUE;
>   
> -   if (result)
> +   if (!result)
>         return VDP_STATUS_INVALID_POINTER;
>   
> +   memset(result, 0, sizeof(*result));
> +   result->handle = -1;
> +
>      pipe_mutex_lock(p_surf->device->mutex);
>      if (p_surf->video_buffer == NULL) {
>         struct pipe_context *pipe = p_surf->device->context;



More information about the mesa-dev mailing list