On Monday, January 26, 2015 11:07:48 AM Juha-Pekka Heikkila wrote: > Check if null pointers were given and bail out. > > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikk...@gmail.com> > --- > 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; > + } > + > 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; >
Unnecessary. This is a static function, so all callers must be in the same source file. Both callers pass the address of a local stack variable, which is clearly not NULL. I'm surprised the static analysis tool wasn't smart enough to figure this out - it's absolutely statically determinable. You could potentially add assert(tmp_pbo != NULL && tmp_tex != NULL); to try and shut up the tool.
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev