[Mesa-dev] [PATCH 2/5] nv50, nvc0: fix potential resource leak in nvXX_create_texture_view()
Spotted by Coverity. Signed-off-by: Samuel Pitoiset--- src/gallium/drivers/nouveau/nv50/nv50_tex.c | 3 ++- src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c index 6083ea9..9fb9dcf 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c @@ -193,7 +193,8 @@ nv50_create_texture_view(struct pipe_context *pipe, break; default: NOUVEAU_ERR("invalid texture target: %d\n", mt->base.base.target); - return false; + FREE(view); + return NULL; } tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c index 2dd100f..2503ee1 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c @@ -195,7 +195,8 @@ nvc0_create_texture_view(struct pipe_context *pipe, default: NOUVEAU_ERR("unexpected/invalid texture target: %d\n", mt->base.base.target); - return false; + FREE(view); + return NULL; } tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030; -- 2.6.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/5] nv50, nvc0: fix potential resource leak in nvXX_create_texture_view()
On 12/14/2015 04:01 PM, Ilia Mirkin wrote: Again, bogus. Can't get there. I'd take a patch that asserts though, or marks it unreachable, or just drops the default case entirely. Make it unreachable is fine by me. On Mon, Dec 14, 2015 at 5:14 AM, Samuel Pitoisetwrote: Spotted by Coverity. Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/nouveau/nv50/nv50_tex.c | 3 ++- src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c index 6083ea9..9fb9dcf 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c @@ -193,7 +193,8 @@ nv50_create_texture_view(struct pipe_context *pipe, break; default: NOUVEAU_ERR("invalid texture target: %d\n", mt->base.base.target); - return false; + FREE(view); + return NULL; } tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c index 2dd100f..2503ee1 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c @@ -195,7 +195,8 @@ nvc0_create_texture_view(struct pipe_context *pipe, default: NOUVEAU_ERR("unexpected/invalid texture target: %d\n", mt->base.base.target); - return false; + FREE(view); + return NULL; } tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030; -- 2.6.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev -- -Samuel ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/5] nv50, nvc0: fix potential resource leak in nvXX_create_texture_view()
Again, bogus. Can't get there. I'd take a patch that asserts though, or marks it unreachable, or just drops the default case entirely. On Mon, Dec 14, 2015 at 5:14 AM, Samuel Pitoisetwrote: > Spotted by Coverity. > > Signed-off-by: Samuel Pitoiset > --- > src/gallium/drivers/nouveau/nv50/nv50_tex.c | 3 ++- > src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c > b/src/gallium/drivers/nouveau/nv50/nv50_tex.c > index 6083ea9..9fb9dcf 100644 > --- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c > +++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c > @@ -193,7 +193,8 @@ nv50_create_texture_view(struct pipe_context *pipe, >break; > default: >NOUVEAU_ERR("invalid texture target: %d\n", mt->base.base.target); > - return false; > + FREE(view); > + return NULL; > } > > tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030; > diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c > b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c > index 2dd100f..2503ee1 100644 > --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c > +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c > @@ -195,7 +195,8 @@ nvc0_create_texture_view(struct pipe_context *pipe, > default: >NOUVEAU_ERR("unexpected/invalid texture target: %d\n", >mt->base.base.target); > - return false; > + FREE(view); > + return NULL; > } > > tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030; > -- > 2.6.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev