[Mesa-dev] [PATCH 2/3] mesa/main: Missing NULL pointer check.
Timothy Arceri
tarceri at itsqueeze.com
Wed Jun 14 21:16:54 UTC 2017
This and the following patch are in no error paths. The result cannot be
NULL unless the function is being used incorrectly. I would rather this
be left as to segfault than to fail silently.
On 15/06/17 02:33, Plamena Manolova wrote:
> In prepare_target it's plausible that the parameters of
> _mesa_lookup_texture might be invalid and NULL is returned,
> so we need a NULL pointer check.
>
> CID: 1412566
> Signed-off-by: Plamena Manolova <plamena.manolova at intel.com>
> ---
> src/mesa/main/copyimage.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
> index 2cb617c..dd97f1a 100644
> --- a/src/mesa/main/copyimage.c
> +++ b/src/mesa/main/copyimage.c
> @@ -228,14 +228,17 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum target,
> } else {
> struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
>
> + *renderbuffer = NULL;
> +
> + if (texObj == NULL)
> + return;
> +
> if (target == GL_TEXTURE_CUBE_MAP) {
> *texImage = texObj->Image[z][level];
> }
> else {
> *texImage = _mesa_select_tex_image(texObj, target, level);
> }
> -
> - *renderbuffer = NULL;
> }
> }
>
>
More information about the mesa-dev
mailing list