tests: Fix memory leaks in DispatchSanity
Needed to pass asan CI. Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8353>
This commit is contained in:
parent
d2f4934121
commit
ab0d17338f
|
@ -79,7 +79,9 @@ extern const struct function gles31_functions_possible[];
|
|||
class DispatchSanity_test : public ::testing::Test {
|
||||
public:
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
void SetUpCtx(gl_api api, unsigned int version);
|
||||
void TearDownCtx();
|
||||
|
||||
struct gl_config visual;
|
||||
struct dd_function_table driver_functions;
|
||||
|
@ -102,6 +104,12 @@ DispatchSanity_test::SetUp()
|
|||
nop_table = (_glapi_proc *) _mesa_new_nop_table(size);
|
||||
}
|
||||
|
||||
void
|
||||
DispatchSanity_test::TearDown()
|
||||
{
|
||||
free(nop_table);
|
||||
}
|
||||
|
||||
void
|
||||
DispatchSanity_test::SetUpCtx(gl_api api, unsigned int version)
|
||||
{
|
||||
|
@ -119,6 +127,13 @@ DispatchSanity_test::SetUpCtx(gl_api api, unsigned int version)
|
|||
_mesa_initialize_vbo_vtxfmt(&ctx);
|
||||
}
|
||||
|
||||
void
|
||||
DispatchSanity_test::TearDownCtx()
|
||||
{
|
||||
_vbo_DestroyContext(&ctx);
|
||||
_mesa_free_context_data(&ctx, false);
|
||||
}
|
||||
|
||||
static const char *
|
||||
offset_to_proc_name_safe(unsigned offset)
|
||||
{
|
||||
|
@ -182,6 +197,7 @@ TEST_F(DispatchSanity_test, GL31_CORE)
|
|||
validate_functions(&ctx, common_desktop_functions_possible, nop_table);
|
||||
validate_functions(&ctx, gl_core_functions_possible, nop_table);
|
||||
validate_nops(&ctx, nop_table);
|
||||
TearDownCtx();
|
||||
}
|
||||
|
||||
TEST_F(DispatchSanity_test, GL30)
|
||||
|
@ -190,6 +206,7 @@ TEST_F(DispatchSanity_test, GL30)
|
|||
validate_functions(&ctx, common_desktop_functions_possible, nop_table);
|
||||
validate_functions(&ctx, gl_compatibility_functions_possible, nop_table);
|
||||
validate_nops(&ctx, nop_table);
|
||||
TearDownCtx();
|
||||
}
|
||||
|
||||
TEST_F(DispatchSanity_test, GLES11)
|
||||
|
@ -197,6 +214,7 @@ TEST_F(DispatchSanity_test, GLES11)
|
|||
SetUpCtx(API_OPENGLES, 11);
|
||||
validate_functions(&ctx, gles11_functions_possible, nop_table);
|
||||
validate_nops(&ctx, nop_table);
|
||||
TearDownCtx();
|
||||
}
|
||||
|
||||
TEST_F(DispatchSanity_test, GLES2)
|
||||
|
@ -204,6 +222,7 @@ TEST_F(DispatchSanity_test, GLES2)
|
|||
SetUpCtx(API_OPENGLES2, 20);
|
||||
validate_functions(&ctx, gles2_functions_possible, nop_table);
|
||||
validate_nops(&ctx, nop_table);
|
||||
TearDownCtx();
|
||||
}
|
||||
|
||||
TEST_F(DispatchSanity_test, GLES3)
|
||||
|
@ -212,6 +231,7 @@ TEST_F(DispatchSanity_test, GLES3)
|
|||
validate_functions(&ctx, gles2_functions_possible, nop_table);
|
||||
validate_functions(&ctx, gles3_functions_possible, nop_table);
|
||||
validate_nops(&ctx, nop_table);
|
||||
TearDownCtx();
|
||||
}
|
||||
|
||||
TEST_F(DispatchSanity_test, GLES31)
|
||||
|
@ -221,6 +241,7 @@ TEST_F(DispatchSanity_test, GLES31)
|
|||
validate_functions(&ctx, gles3_functions_possible, nop_table);
|
||||
validate_functions(&ctx, gles31_functions_possible, nop_table);
|
||||
validate_nops(&ctx, nop_table);
|
||||
TearDownCtx();
|
||||
}
|
||||
|
||||
const struct function common_desktop_functions_possible[] = {
|
||||
|
|
Loading…
Reference in New Issue