On Jan 26, 2015 1:08 AM, "Juha-Pekka Heikkila" <[email protected]>
wrote:
>
> Check if null pointers were given and bail out.
>
> Signed-off-by: Juha-Pekka Heikkila <[email protected]>
> ---
>  src/mesa/drivers/common/meta_tex_subimage.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c
b/src/mesa/drivers/common/meta_tex_subimage.c
> index 977ee5a..cd5218e 100644
> --- a/src/mesa/drivers/common/meta_tex_subimage.c
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> @@ -82,6 +82,8 @@ create_texture_for_pbo(struct gl_context *ctx, bool
create_pbo,
>        assert(create_pbo);
>
>        _mesa_GenBuffers(1, tmp_pbo);
> +      if (!tmp_pbo)
> +         return NULL;
>
>        /* We are not doing this inside meta_begin/end.  However, we know
the
>         * client doesn't have the given target bound, so we can go ahead
and
> @@ -98,6 +100,11 @@ create_texture_for_pbo(struct gl_context *ctx, bool
create_pbo,
>     }
>
>     _mesa_GenTextures(1, tmp_tex);
> +   if (!tmp_tex) {
> +      _mesa_DeleteBuffers(1, tmp_pbo);
> +      return NULL;

As Ken said, those two pointers will never be null.  The potential NULL
that coverity is complaining about is probably actually two lines down
where we look up the texture object.

> +   }
> +
>     tex_obj = _mesa_lookup_texture(ctx, *tmp_tex);
>     tex_obj->Target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
>     tex_obj->Immutable = GL_TRUE;
> --
> 1.8.5.1
>
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to