From: Pyry Haulos Date: Thu, 4 Aug 2016 18:34:52 +0000 (-0700) Subject: Fix tcu::Resource leak in draw and dynamic_state tests X-Git-Tag: upstream/0.1.0~662^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29ea2c762654768704984bcdf8f7d38af364bf66;p=platform%2Fupstream%2FVK-GL-CTS.git Fix tcu::Resource leak in draw and dynamic_state tests --- diff --git a/external/vulkancts/modules/vulkan/draw/vktDrawTestCaseUtil.hpp b/external/vulkancts/modules/vulkan/draw/vktDrawTestCaseUtil.hpp index ab60987..c77783d 100644 --- a/external/vulkancts/modules/vulkan/draw/vktDrawTestCaseUtil.hpp +++ b/external/vulkancts/modules/vulkan/draw/vktDrawTestCaseUtil.hpp @@ -33,6 +33,8 @@ #include "gluShaderUtil.hpp" #include "vkPrograms.hpp" +#include "deUniquePtr.hpp" + #include namespace vkt @@ -45,13 +47,13 @@ class ShaderSourceProvider public: static std::string getSource (tcu::Archive& archive, const char* path) { - tcu::Resource *resource = archive.getResource(path); + de::UniquePtr resource(archive.getResource(path)); std::vector readBuffer(resource->getSize() + 1); resource->read(&readBuffer[0], resource->getSize()); readBuffer[readBuffer.size() - 1] = 0; - return reinterpret_cast(&readBuffer[0]); + return std::string(reinterpret_cast(&readBuffer[0])); } }; diff --git a/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateTestCaseUtil.hpp b/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateTestCaseUtil.hpp index b78799d..7f8ee06 100644 --- a/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateTestCaseUtil.hpp +++ b/external/vulkancts/modules/vulkan/dynamic_state/vktDynamicStateTestCaseUtil.hpp @@ -32,6 +32,8 @@ #include "gluShaderUtil.hpp" #include "vkPrograms.hpp" +#include "deUniquePtr.hpp" + #include namespace vkt @@ -54,13 +56,13 @@ class ShaderSourceProvider public: static std::string getSource(tcu::Archive& archive, const char* path) { - tcu::Resource *resource = archive.getResource(path); + de::UniquePtr resource(archive.getResource(path)); std::vector readBuffer(resource->getSize() + 1); resource->read(&readBuffer[0], resource->getSize()); readBuffer[readBuffer.size() - 1] = 0; - return reinterpret_cast(&readBuffer[0]); + return std::string(reinterpret_cast(&readBuffer[0])); } };