st/va: Check NULL pointer
authorGurkirpal Singh <gurkirpal204@gmail.com>
Sun, 26 Jun 2016 07:02:25 +0000 (12:32 +0530)
committerJulien Isorce <j.isorce@samsung.com>
Mon, 27 Jun 2016 07:09:08 +0000 (08:09 +0100)
Call to handle_table_get in vlVaDestroySurfaces can
return NULL on failure.

CID: 1243522

Signed-off-by: Gurkirpal Singh <gurkirpal204@gmail.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
src/gallium/state_trackers/va/surface.c

index 5efb8934c5cbda2b2a664baf7e7075c7cbeb7372..3e74353f6defea3a458fe92c242ecb374056e66d 100644 (file)
@@ -71,6 +71,10 @@ vlVaDestroySurfaces(VADriverContextP ctx, VASurfaceID *surface_list, int num_sur
    pipe_mutex_lock(drv->mutex);
    for (i = 0; i < num_surfaces; ++i) {
       vlVaSurface *surf = handle_table_get(drv->htab, surface_list[i]);
+      if (!surf) {
+         pipe_mutex_unlock(drv->mutex);
+         return VA_STATUS_ERROR_INVALID_SURFACE;
+      }
       if (surf->buffer)
          surf->buffer->destroy(surf->buffer);
       util_dynarray_fini(&surf->subpics);