summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinson Lee <vlee@freedesktop.org>2024-02-17 21:12:21 -0800
committerVinson Lee <vlee@freedesktop.org>2024-03-20 23:20:49 -0700
commit19e58247e4b7b24f1c5ea3694eafaac998ceea76 (patch)
treeea38f2e464555c2aa583d8a68aa20baea2967118
parentd0b5d0c1f2cc8d5a0cb2e88c0a39af71b0f09526 (diff)
ext_texture_storage: Fix memory leak on error path
Fix defects reported by Coverity Scan. Resource leak (RESOURCE_LEAK) leaked_storage: Variable name going out of scope leaks the storage it points to. leaked_storage: Variable opt going out of scope leaks the storage it points to. Fixes: cc1e4d6761a9 ("Add GL_EXT_texture_storage tests") Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/879>
-rw-r--r--tests/spec/ext_texture_storage/formats.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/spec/ext_texture_storage/formats.c b/tests/spec/ext_texture_storage/formats.c
index 262fa6f5b..95972ef8a 100644
--- a/tests/spec/ext_texture_storage/formats.c
+++ b/tests/spec/ext_texture_storage/formats.c
@@ -169,8 +169,11 @@ piglit_init(int argc, char **argv)
name = calloc(strlen(lead) + ext_len + 1, 1);
opt = calloc(ext_len + 1, 1);
- if (!name || !opt)
+ if (!name || !opt) {
+ free(name);
+ free(opt);
return;
+ }
strcat(name, lead);