Mesa (staging/19.0): v3d: Fix leak in resource setup error path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 31 20:00:59 UTC 2019


Module: Mesa
Branch: staging/19.0
Commit: c824f8031cee0f4be10943438ffa264fd09ac4e4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c824f8031cee0f4be10943438ffa264fd09ac4e4

Author: Ernestas Kulik <ernestas.kulik at gmail.com>
Date:   Thu Aug 30 19:02:46 2018 +0300

v3d: Fix leak in resource setup error path

Reported by Coverity: in the case of unsupported modifier request, the
code does not jump to the “fail” label to destroy the acquired resource.

CID: 1435704
Signed-off-by: Ernestas Kulik <ernestas.kulik at gmail.com>
Fixes: 45bb8f295710 ("broadcom: Add V3D 3.3 gallium driver called "vc5", for BCM7268.")
(cherry picked from commit 90458bef544ac46a912f06e73f71c3cb20fdaaf6)

---

 src/gallium/drivers/v3d/v3d_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c
index 21c68942e1..84e86799d5 100644
--- a/src/gallium/drivers/v3d/v3d_resource.c
+++ b/src/gallium/drivers/v3d/v3d_resource.c
@@ -780,7 +780,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
                 rsc->tiled = false;
         } else {
                 fprintf(stderr, "Unsupported modifier requested\n");
-                return NULL;
+                goto fail;
         }
 
         rsc->internal_format = prsc->format;




More information about the mesa-commit mailing list