[Mesa-dev] [v6 6/9] intel: prepare for dri images having more than one plane

Eric Anholt eric at anholt.net
Tue May 28 13:33:58 PDT 2013


Topi Pohjolainen <topi.pohjolainen at intel.com> writes:
> diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
> index 57c8417..e8ed622 100644
> --- a/src/mesa/drivers/dri/intel/intel_screen.c
> +++ b/src/mesa/drivers/dri/intel/intel_screen.c
> @@ -491,8 +491,18 @@ intel_create_image_from_texture(__DRIcontext *context, int target,
>  static void
>  intel_destroy_image(__DRIimage *image)
>  {
> -    intel_region_release(&image->regions[0]);
> -    free(image);
> +   int i;
> +
> +   for (i = 0; i < intel_image_get_region_count(image); ++i) {
> +      /**
> +       * Failures during creation are cleaned up here and hence not all the
> +       * regions may not be valid.
> +       */
> +      if (image->regions[i])
> +         intel_region_release(&image->regions[i]);
> +   }

intel_region_release() checks for NULL anyway, so no need to explicitly
do so here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130528/7649b6d7/attachment.pgp>


More information about the mesa-dev mailing list