Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: src/gpu/vk/GrVkExtensions.cpp

Issue 1867883002: Fix a bunch of memory issues in Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@vkValgrind
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/vk/GrVkExtensions.cpp
diff --git a/src/gpu/vk/GrVkExtensions.cpp b/src/gpu/vk/GrVkExtensions.cpp
index 2bec2354f66f1dc71fab83f72f3cdb1b41d94efc..c1ca2dd3a21e32c4d5c537188be86de7d8e93872 100644
--- a/src/gpu/vk/GrVkExtensions.cpp
+++ b/src/gpu/vk/GrVkExtensions.cpp
@@ -53,6 +53,7 @@ bool GrVkExtensions::initInstance(uint32_t specVersion) {
VkLayerProperties* layers = new VkLayerProperties[layerCount];
res = EnumerateInstanceLayerProperties(&layerCount, layers);
if (VK_SUCCESS != res) {
+ delete[] layers;
return false;
}
for (uint32_t i = 0; i < layerCount; ++i) {
@@ -75,6 +76,7 @@ bool GrVkExtensions::initInstance(uint32_t specVersion) {
VkExtensionProperties* extensions = new VkExtensionProperties[extensionCount];
res = EnumerateInstanceExtensionProperties(nullptr, &extensionCount, extensions);
if (VK_SUCCESS != res) {
+ delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
@@ -100,6 +102,7 @@ bool GrVkExtensions::initInstance(uint32_t specVersion) {
res = EnumerateInstanceExtensionProperties((*fInstanceLayerStrings)[layerIndex].c_str(),
&extensionCount, extensions);
if (VK_SUCCESS != res) {
+ delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
@@ -138,6 +141,7 @@ bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
VkLayerProperties* layers = new VkLayerProperties[layerCount];
res = EnumerateDeviceLayerProperties(physDev, &layerCount, layers);
if (VK_SUCCESS != res) {
+ delete[] layers;
return false;
}
for (uint32_t i = 0; i < layerCount; ++i) {
@@ -161,6 +165,7 @@ bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
VkExtensionProperties* extensions = new VkExtensionProperties[extensionCount];
res = EnumerateDeviceExtensionProperties(physDev, nullptr, &extensionCount, extensions);
if (VK_SUCCESS != res) {
+ delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
@@ -188,6 +193,7 @@ bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
(*fDeviceLayerStrings)[layerIndex].c_str(),
&extensionCount, extensions);
if (VK_SUCCESS != res) {
+ delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {

Powered by Google App Engine
This is Rietveld 408576698