gl3cTransformFeedbackTests: use delete[] to match new[]
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 20 Nov 2017 16:45:49 +0000 (17:45 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 22 Nov 2017 08:22:15 +0000 (03:22 -0500)
C++ requires that memory allocated by new[] is freed using delete[]
instead of just plain delete. This does not really have an effect in
practice, but it does fix an error reported by Address Sanitizer:

=================================================================
==12338==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x6020000634b0
    #0 0x7f21af5b3580 in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc8580)
    #1 0x55d795f901ae in gl3cts::TransformFeedback::APIErrors::testExtension1() /home/nha/amd/tests/cts/external/openglcts/modules/gl/gl3cTransformFeedbackTests.cpp:837
    #2 0x55d795f9d71f in gl3cts::TransformFeedback::APIErrors::iterate() /home/nha/amd/tests/cts/external/openglcts/modules/gl/gl3cTransformFeedbackTests.cpp:251
    #3 0x55d795f64736 in gl3cts::TestCaseWrapper::iterate(tcu::TestCase*) /home/nha/amd/tests/cts/external/openglcts/modules/gl/gl3cTestPackages.cpp:100
    #4 0x55d797d10682 in tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*) /home/nha/amd/tests/cts/framework/common/tcuTestSessionExecutor.cpp:272
    #5 0x55d797d10798 in tcu::TestSessionExecutor::iterate() /home/nha/amd/tests/cts/framework/common/tcuTestSessionExecutor.cpp:135
    #6 0x55d797cf0748 in tcu::App::iterate() /home/nha/amd/tests/cts/framework/common/tcuApp.cpp:173
    #7 0x55d795f15967 in main /home/nha/amd/tests/cts/framework/platform/tcuMain.cpp:55
    #8 0x7f21adceb3f0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x203f0)
    #9 0x55d795f5e449 in _start (/mnt/9a5f7d49-0504-436d-83ae-10198f821499/nha/amd/tests/cts/build/external/openglcts/modules/glcts+0xa55449)

0x6020000634b0 is located 0 bytes inside of 3-byte region [0x6020000634b0,0x6020000634b3)
allocated by thread T0 here:
    #0 0x7f21af5b30a0 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc80a0)
    #1 0x55d795f900da in gl3cts::TransformFeedback::APIErrors::testExtension1() /home/nha/amd/tests/cts/external/openglcts/modules/gl/gl3cTransformFeedbackTests.cpp:826

Component: OpenGL
VK-GL-CTS issue: 858
Affects:
KHR-GL45.transform_feedback.api_errors_test

Change-Id: Ie0872535d224c27cc6864fb71aaf7eb219661a02

external/openglcts/modules/gl/gl3cTransformFeedbackTests.cpp

index 93633f9..a72d778 100644 (file)
@@ -834,7 +834,7 @@ bool gl3cts::TransformFeedback::APIErrors::testExtension1(void)
 
        for (glw::GLint i = 0; i < more_than_max_separate_attribs; ++i)
        {
-               delete attrib[i];
+               delete[] attrib[i];
        }
 
        delete[] attrib;