layers: roll back non-const refs to pointers

Change-Id: I255510b4233867cf5d9b16ea94790ef9409a7939
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp
index 1e3a1ee..e3398ed 100644
--- a/layers/descriptor_sets.cpp
+++ b/layers/descriptor_sets.cpp
@@ -888,11 +888,11 @@
 }
 // Validate Copy update
 bool cvdescriptorset::DescriptorSet::ValidateCopyUpdate(const debug_report_data *report_data, const VkCopyDescriptorSet *update,
-                                                        const DescriptorSet *src_set, std::string &error_code,
+                                                        const DescriptorSet *src_set, std::string *error_code,
                                                         std::string *error_msg) {
     // Verify dst layout still valid
     if (p_layout_->IsDestroyed()) {
-        error_code = "VUID-VkCopyDescriptorSet-dstSet-parameter";
+        *error_code = "VUID-VkCopyDescriptorSet-dstSet-parameter";
         string_sprintf(error_msg,
                        "Cannot call vkUpdateDescriptorSets() to perform copy update on descriptor set dstSet 0x%" PRIxLEAST64
                        " created with destroyed VkDescriptorSetLayout 0x%" PRIxLEAST64,
@@ -902,7 +902,7 @@
 
     // Verify src layout still valid
     if (src_set->p_layout_->IsDestroyed()) {
-        error_code = "VUID-VkCopyDescriptorSet-srcSet-parameter";
+        *error_code = "VUID-VkCopyDescriptorSet-srcSet-parameter";
         string_sprintf(
             error_msg,
             "Cannot call vkUpdateDescriptorSets() to perform copy update of dstSet 0x%" PRIxLEAST64
@@ -912,14 +912,14 @@
     }
 
     if (!p_layout_->HasBinding(update->dstBinding)) {
-        error_code = "VUID-VkCopyDescriptorSet-dstBinding-00347";
+        *error_code = "VUID-VkCopyDescriptorSet-dstBinding-00347";
         std::stringstream error_str;
         error_str << "DescriptorSet " << set_ << " does not have copy update dest binding of " << update->dstBinding;
         *error_msg = error_str.str();
         return false;
     }
     if (!src_set->HasBinding(update->srcBinding)) {
-        error_code = "VUID-VkCopyDescriptorSet-srcBinding-00345";
+        *error_code = "VUID-VkCopyDescriptorSet-srcBinding-00345";
         std::stringstream error_str;
         error_str << "DescriptorSet " << set_ << " does not have copy update src binding of " << update->srcBinding;
         *error_msg = error_str.str();
@@ -930,7 +930,7 @@
         !(p_layout_->GetDescriptorBindingFlagsFromBinding(update->dstBinding) &
           (VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT))) {
         // TODO : Re-using Free Idle error code, need copy update idle error code
-        error_code = "VUID-vkFreeDescriptorSets-pDescriptorSets-00309";
+        *error_code = "VUID-vkFreeDescriptorSets-pDescriptorSets-00309";
         std::stringstream error_str;
         error_str << "Cannot call vkUpdateDescriptorSets() to perform copy update on descriptor set " << set_
                   << " that is in use by a command buffer";
@@ -942,7 +942,7 @@
     auto src_start_idx = src_set->GetGlobalIndexRangeFromBinding(update->srcBinding).start + update->srcArrayElement;
     if ((src_start_idx + update->descriptorCount) > src_set->GetTotalDescriptorCount()) {
         // SRC update out of bounds
-        error_code = "VUID-VkCopyDescriptorSet-srcArrayElement-00346";
+        *error_code = "VUID-VkCopyDescriptorSet-srcArrayElement-00346";
         std::stringstream error_str;
         error_str << "Attempting copy update from descriptorSet " << update->srcSet << " binding#" << update->srcBinding
                   << " with offset index of " << src_set->GetGlobalIndexRangeFromBinding(update->srcBinding).start
@@ -954,7 +954,7 @@
     auto dst_start_idx = p_layout_->GetGlobalIndexRangeFromBinding(update->dstBinding).start + update->dstArrayElement;
     if ((dst_start_idx + update->descriptorCount) > p_layout_->GetTotalDescriptorCount()) {
         // DST update out of bounds
-        error_code = "VUID-VkCopyDescriptorSet-dstArrayElement-00348";
+        *error_code = "VUID-VkCopyDescriptorSet-dstArrayElement-00348";
         std::stringstream error_str;
         error_str << "Attempting copy update to descriptorSet " << set_ << " binding#" << update->dstBinding
                   << " with offset index of " << p_layout_->GetGlobalIndexRangeFromBinding(update->dstBinding).start
@@ -966,7 +966,7 @@
     // Check that types match
     // TODO : Base default error case going from here is "VUID-VkAcquireNextImageInfoKHR-semaphore-parameter"2ba which covers all
     // consistency issues, need more fine-grained error codes
-    error_code = "VUID-VkCopyDescriptorSet-srcSet-00349";
+    *error_code = "VUID-VkCopyDescriptorSet-srcSet-00349";
     auto src_type = src_set->GetTypeFromBinding(update->srcBinding);
     auto dst_type = p_layout_->GetTypeFromBinding(update->dstBinding);
     if (src_type != dst_type) {
@@ -987,7 +987,7 @@
 
     if ((src_set->GetLayout()->GetCreateFlags() & VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT) &&
         !(GetLayout()->GetCreateFlags() & VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT)) {
-        error_code = "VUID-VkCopyDescriptorSet-srcSet-01918";
+        *error_code = "VUID-VkCopyDescriptorSet-srcSet-01918";
         std::stringstream error_str;
         error_str << "If pname:srcSet's (" << update->srcSet
                   << ") layout was created with the "
@@ -1002,7 +1002,7 @@
 
     if (!(src_set->GetLayout()->GetCreateFlags() & VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT) &&
         (GetLayout()->GetCreateFlags() & VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT)) {
-        error_code = "VUID-VkCopyDescriptorSet-srcSet-01919";
+        *error_code = "VUID-VkCopyDescriptorSet-srcSet-01919";
         std::stringstream error_str;
         error_str << "If pname:srcSet's (" << update->srcSet
                   << ") layout was created without the "
@@ -1017,7 +1017,7 @@
 
     if ((src_set->GetPoolState()->createInfo.flags & VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT) &&
         !(GetPoolState()->createInfo.flags & VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT)) {
-        error_code = "VUID-VkCopyDescriptorSet-srcSet-01920";
+        *error_code = "VUID-VkCopyDescriptorSet-srcSet-01920";
         std::stringstream error_str;
         error_str << "If the descriptor pool from which pname:srcSet (" << update->srcSet
                   << ") was allocated was created "
@@ -1032,7 +1032,7 @@
 
     if (!(src_set->GetPoolState()->createInfo.flags & VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT) &&
         (GetPoolState()->createInfo.flags & VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT)) {
-        error_code = "VUID-VkCopyDescriptorSet-srcSet-01921";
+        *error_code = "VUID-VkCopyDescriptorSet-srcSet-01921";
         std::stringstream error_str;
         error_str << "If the descriptor pool from which pname:srcSet (" << update->srcSet
                   << ") was allocated was created "
@@ -1176,9 +1176,9 @@
 }
 
 bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout image_layout, VkDescriptorType type,
-                                          const layer_data *dev_data, std::string &error_code, std::string *error_msg) {
+                                          const layer_data *dev_data, std::string *error_code, std::string *error_msg) {
     // TODO : Defaulting to 00943 for all cases here. Need to create new error codes for various cases.
-    error_code = "VUID-VkWriteDescriptorSet-descriptorType-00326";
+    *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00326";
     auto iv_state = GetImageViewState(dev_data, image_view);
     if (!iv_state) {
         std::stringstream error_str;
@@ -1202,7 +1202,7 @@
         //  the error here occurs is if memory bound to a created imageView has been freed.
         if (ValidateMemoryIsBoundToImage(dev_data, image_node, "vkUpdateDescriptorSets()",
                                          "VUID-VkImageViewCreateInfo-image-01020")) {
-            error_code = "VUID-VkImageViewCreateInfo-image-01020";
+            *error_code = "VUID-VkImageViewCreateInfo-image-01020";
             *error_msg = "No memory bound to image.";
             return false;
         }
@@ -1212,7 +1212,7 @@
         if (image_node->createInfo.imageType == VK_IMAGE_TYPE_3D &&
             (iv_state->create_info.viewType == VK_IMAGE_VIEW_TYPE_2D ||
              iv_state->create_info.viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY)) {
-            error_code = "VUID-VkDescriptorImageInfo-imageView-00343";
+            *error_code = "VUID-VkDescriptorImageInfo-imageView-00343";
             *error_msg = "ImageView must not be a 2D or 2DArray view of a 3D image";
             return false;
         }
@@ -1537,7 +1537,7 @@
         } else {
             std::string error_code;
             std::string error_str;
-            if (!set_node->ValidateWriteUpdate(report_data, &p_wds[i], error_code, &error_str)) {
+            if (!set_node->ValidateWriteUpdate(report_data, &p_wds[i], &error_code, &error_str)) {
                 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
                                 HandleToUint64(dest_set), error_code,
                                 "vkUpdateDescriptorSets() failed write update validation for Descriptor Set 0x%" PRIx64
@@ -1557,7 +1557,7 @@
         assert(dst_node);
         std::string error_code;
         std::string error_str;
-        if (!dst_node->ValidateCopyUpdate(report_data, &p_cds[i], src_node, error_code, &error_str)) {
+        if (!dst_node->ValidateCopyUpdate(report_data, &p_cds[i], src_node, &error_code, &error_str)) {
             skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
                             HandleToUint64(dst_set), error_code,
                             "vkUpdateDescriptorSets() failed copy update from Descriptor Set 0x%" PRIx64
@@ -1666,10 +1666,10 @@
 // Validate the state for a given write update but don't actually perform the update
 //  If an error would occur for this update, return false and fill in details in error_msg string
 bool cvdescriptorset::DescriptorSet::ValidateWriteUpdate(const debug_report_data *report_data, const VkWriteDescriptorSet *update,
-                                                         std::string &error_code, std::string *error_msg) {
+                                                         std::string *error_code, std::string *error_msg) {
     // Verify dst layout still valid
     if (p_layout_->IsDestroyed()) {
-        error_code = "VUID-VkWriteDescriptorSet-dstSet-00320";
+        *error_code = "VUID-VkWriteDescriptorSet-dstSet-00320";
         string_sprintf(error_msg,
                        "Cannot call vkUpdateDescriptorSets() to perform write update on descriptor set 0x%" PRIxLEAST64
                        " created with destroyed VkDescriptorSetLayout 0x%" PRIxLEAST64,
@@ -1678,7 +1678,7 @@
     }
     // Verify dst binding exists
     if (!p_layout_->HasBinding(update->dstBinding)) {
-        error_code = "VUID-VkWriteDescriptorSet-dstBinding-00315";
+        *error_code = "VUID-VkWriteDescriptorSet-dstBinding-00315";
         std::stringstream error_str;
         error_str << "DescriptorSet " << set_ << " does not have binding " << update->dstBinding;
         *error_msg = error_str.str();
@@ -1686,7 +1686,7 @@
     } else {
         // Make sure binding isn't empty
         if (0 == p_layout_->GetDescriptorCountFromBinding(update->dstBinding)) {
-            error_code = "VUID-VkWriteDescriptorSet-dstBinding-00316";
+            *error_code = "VUID-VkWriteDescriptorSet-dstBinding-00316";
             std::stringstream error_str;
             error_str << "DescriptorSet " << set_ << " cannot updated binding " << update->dstBinding << " that has 0 descriptors";
             *error_msg = error_str.str();
@@ -1698,7 +1698,7 @@
         !(p_layout_->GetDescriptorBindingFlagsFromBinding(update->dstBinding) &
           (VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT | VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT))) {
         // TODO : Re-using Free Idle error code, need write update idle error code
-        error_code = "VUID-vkFreeDescriptorSets-pDescriptorSets-00309";
+        *error_code = "VUID-vkFreeDescriptorSets-pDescriptorSets-00309";
         std::stringstream error_str;
         error_str << "Cannot call vkUpdateDescriptorSets() to perform write update on descriptor set " << set_
                   << " that is in use by a command buffer";
@@ -1709,7 +1709,7 @@
     auto start_idx = p_layout_->GetGlobalIndexRangeFromBinding(update->dstBinding).start + update->dstArrayElement;
     auto type = p_layout_->GetTypeFromBinding(update->dstBinding);
     if (type != update->descriptorType) {
-        error_code = "VUID-VkWriteDescriptorSet-descriptorType-00319";
+        *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00319";
         std::stringstream error_str;
         error_str << "Attempting write update to descriptor set " << set_ << " binding #" << update->dstBinding << " with type "
                   << string_VkDescriptorType(type) << " but update type is " << string_VkDescriptorType(update->descriptorType);
@@ -1717,7 +1717,7 @@
         return false;
     }
     if (update->descriptorCount > (descriptors_.size() - start_idx)) {
-        error_code = "VUID-VkWriteDescriptorSet-dstArrayElement-00321";
+        *error_code = "VUID-VkWriteDescriptorSet-dstArrayElement-00321";
         std::stringstream error_str;
         error_str << "Attempting write update to descriptor set " << set_ << " binding #" << update->dstBinding << " with "
                   << descriptors_.size() - start_idx
@@ -1731,7 +1731,7 @@
     if (!p_layout_->VerifyUpdateConsistency(update->dstBinding, update->dstArrayElement, update->descriptorCount, "write update to",
                                             set_, error_msg)) {
         // TODO : Should break out "consecutive binding updates" language into valid usage statements
-        error_code = "VUID-VkWriteDescriptorSet-dstArrayElement-00321";
+        *error_code = "VUID-VkWriteDescriptorSet-dstArrayElement-00321";
         return false;
     }
     // Update is within bounds and consistent so last step is to validate update contents
@@ -1748,34 +1748,34 @@
 // For the given buffer, verify that its creation parameters are appropriate for the given type
 //  If there's an error, update the error_msg string with details and return false, else return true
 bool cvdescriptorset::DescriptorSet::ValidateBufferUsage(BUFFER_STATE const *buffer_node, VkDescriptorType type,
-                                                         std::string &error_code, std::string *error_msg) const {
+                                                         std::string *error_code, std::string *error_msg) const {
     // Verify that usage bits set correctly for given type
     auto usage = buffer_node->createInfo.usage;
     std::string error_usage_bit;
     switch (type) {
         case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
             if (!(usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT)) {
-                error_code = "VUID-VkWriteDescriptorSet-descriptorType-00334";
+                *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00334";
                 error_usage_bit = "VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT";
             }
             break;
         case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
             if (!(usage & VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)) {
-                error_code = "VUID-VkWriteDescriptorSet-descriptorType-00335";
+                *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00335";
                 error_usage_bit = "VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT";
             }
             break;
         case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
         case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
             if (!(usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT)) {
-                error_code = "VUID-VkWriteDescriptorSet-descriptorType-00330";
+                *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00330";
                 error_usage_bit = "VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT";
             }
             break;
         case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
         case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
             if (!(usage & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)) {
-                error_code = "VUID-VkWriteDescriptorSet-descriptorType-00331";
+                *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00331";
                 error_usage_bit = "VK_BUFFER_USAGE_STORAGE_BUFFER_BIT";
             }
             break;
@@ -1800,14 +1800,14 @@
 //  5. range and offset are within the device's limits
 // If there's an error, update the error_msg string with details and return false, else return true
 bool cvdescriptorset::DescriptorSet::ValidateBufferUpdate(VkDescriptorBufferInfo const *buffer_info, VkDescriptorType type,
-                                                          std::string &error_code, std::string *error_msg) const {
+                                                          std::string *error_code, std::string *error_msg) const {
     // First make sure that buffer is valid
     auto buffer_node = GetBufferState(device_data_, buffer_info->buffer);
     // Any invalid buffer should already be caught by object_tracker
     assert(buffer_node);
     if (ValidateMemoryIsBoundToBuffer(device_data_, buffer_node, "vkUpdateDescriptorSets()",
                                       "VUID-VkWriteDescriptorSet-descriptorType-00329")) {
-        error_code = "VUID-VkWriteDescriptorSet-descriptorType-00329";
+        *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00329";
         *error_msg = "No memory bound to buffer.";
         return false;
     }
@@ -1818,7 +1818,7 @@
     }
     // offset must be less than buffer size
     if (buffer_info->offset >= buffer_node->createInfo.size) {
-        error_code = "VUID-VkDescriptorBufferInfo-offset-00340";
+        *error_code = "VUID-VkDescriptorBufferInfo-offset-00340";
         std::stringstream error_str;
         error_str << "VkDescriptorBufferInfo offset of " << buffer_info->offset << " is greater than or equal to buffer "
                   << buffer_node->buffer << " size of " << buffer_node->createInfo.size;
@@ -1828,7 +1828,7 @@
     if (buffer_info->range != VK_WHOLE_SIZE) {
         // Range must be VK_WHOLE_SIZE or > 0
         if (!buffer_info->range) {
-            error_code = "VUID-VkDescriptorBufferInfo-range-00341";
+            *error_code = "VUID-VkDescriptorBufferInfo-range-00341";
             std::stringstream error_str;
             error_str << "VkDescriptorBufferInfo range is not VK_WHOLE_SIZE and is zero, which is not allowed.";
             *error_msg = error_str.str();
@@ -1836,7 +1836,7 @@
         }
         // Range must be VK_WHOLE_SIZE or <= (buffer size - offset)
         if (buffer_info->range > (buffer_node->createInfo.size - buffer_info->offset)) {
-            error_code = "VUID-VkDescriptorBufferInfo-range-00342";
+            *error_code = "VUID-VkDescriptorBufferInfo-range-00342";
             std::stringstream error_str;
             error_str << "VkDescriptorBufferInfo range is " << buffer_info->range << " which is greater than buffer size ("
                       << buffer_node->createInfo.size << ") minus requested offset of " << buffer_info->offset;
@@ -1849,7 +1849,7 @@
         auto max_ub_range = limits_.maxUniformBufferRange;
         // TODO : If range is WHOLE_SIZE, need to make sure underlying buffer size doesn't exceed device max
         if (buffer_info->range != VK_WHOLE_SIZE && buffer_info->range > max_ub_range) {
-            error_code = "VUID-VkWriteDescriptorSet-descriptorType-00332";
+            *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00332";
             std::stringstream error_str;
             error_str << "VkDescriptorBufferInfo range is " << buffer_info->range
                       << " which is greater than this device's maxUniformBufferRange (" << max_ub_range << ")";
@@ -1860,7 +1860,7 @@
         auto max_sb_range = limits_.maxStorageBufferRange;
         // TODO : If range is WHOLE_SIZE, need to make sure underlying buffer size doesn't exceed device max
         if (buffer_info->range != VK_WHOLE_SIZE && buffer_info->range > max_sb_range) {
-            error_code = "VUID-VkWriteDescriptorSet-descriptorType-00333";
+            *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00333";
             std::stringstream error_str;
             error_str << "VkDescriptorBufferInfo range is " << buffer_info->range
                       << " which is greater than this device's maxStorageBufferRange (" << max_sb_range << ")";
@@ -1873,7 +1873,7 @@
 
 // Verify that the contents of the update are ok, but don't perform actual update
 bool cvdescriptorset::DescriptorSet::VerifyWriteUpdateContents(const VkWriteDescriptorSet *update, const uint32_t index,
-                                                               std::string &error_code, std::string *error_msg) const {
+                                                               std::string *error_code, std::string *error_msg) const {
     switch (update->descriptorType) {
         case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
             for (uint32_t di = 0; di < update->descriptorCount; ++di) {
@@ -1894,7 +1894,7 @@
             for (uint32_t di = 0; di < update->descriptorCount; ++di) {
                 if (!descriptors_[index + di].get()->IsImmutableSampler()) {
                     if (!ValidateSampler(update->pImageInfo[di].sampler, device_data_)) {
-                        error_code = "VUID-VkWriteDescriptorSet-descriptorType-00325";
+                        *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00325";
                         std::stringstream error_str;
                         error_str << "Attempted write update to sampler descriptor with invalid sampler: "
                                   << update->pImageInfo[di].sampler << ".";
@@ -1928,7 +1928,7 @@
                 auto buffer_view = update->pTexelBufferView[di];
                 auto bv_state = GetBufferViewState(device_data_, buffer_view);
                 if (!bv_state) {
-                    error_code = "VUID-VkWriteDescriptorSet-descriptorType-00323";
+                    *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00323";
                     std::stringstream error_str;
                     error_str << "Attempted write update to texel buffer descriptor with invalid buffer view: " << buffer_view;
                     *error_msg = error_str.str();
@@ -1938,7 +1938,7 @@
                 auto buffer_state = GetBufferState(device_data_, buffer);
                 // Verify that buffer underlying the view hasn't been destroyed prematurely
                 if (!buffer_state) {
-                    error_code = "VUID-VkWriteDescriptorSet-descriptorType-00323";
+                    *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00323";
                     std::stringstream error_str;
                     error_str << "Attempted write update to texel buffer descriptor failed because underlying buffer (" << buffer
                               << ") has been destroyed: " << error_msg->c_str();
@@ -1976,7 +1976,7 @@
 }
 // Verify that the contents of the update are ok, but don't perform actual update
 bool cvdescriptorset::DescriptorSet::VerifyCopyUpdateContents(const VkCopyDescriptorSet *update, const DescriptorSet *src_set,
-                                                              VkDescriptorType type, uint32_t index, std::string &error_code,
+                                                              VkDescriptorType type, uint32_t index, std::string *error_code,
                                                               std::string *error_msg) const {
     // Note : Repurposing some Write update error codes here as specific details aren't called out for copy updates like they are
     // for write updates
@@ -1988,7 +1988,7 @@
                 if (!src_desc->IsImmutableSampler()) {
                     auto update_sampler = static_cast<SamplerDescriptor *>(src_desc)->GetSampler();
                     if (!ValidateSampler(update_sampler, device_data_)) {
-                        error_code = "VUID-VkWriteDescriptorSet-descriptorType-00325";
+                        *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00325";
                         std::stringstream error_str;
                         error_str << "Attempted copy update to sampler descriptor with invalid sampler: " << update_sampler << ".";
                         *error_msg = error_str.str();
@@ -2009,7 +2009,7 @@
                 if (!img_samp_desc->IsImmutableSampler()) {
                     auto update_sampler = img_samp_desc->GetSampler();
                     if (!ValidateSampler(update_sampler, device_data_)) {
-                        error_code = "VUID-VkWriteDescriptorSet-descriptorType-00325";
+                        *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00325";
                         std::stringstream error_str;
                         error_str << "Attempted copy update to sampler descriptor with invalid sampler: " << update_sampler << ".";
                         *error_msg = error_str.str();
@@ -2053,7 +2053,7 @@
                 auto buffer_view = static_cast<TexelDescriptor *>(src_desc)->GetBufferView();
                 auto bv_state = GetBufferViewState(device_data_, buffer_view);
                 if (!bv_state) {
-                    error_code = "VUID-VkWriteDescriptorSet-descriptorType-00323";
+                    *error_code = "VUID-VkWriteDescriptorSet-descriptorType-00323";
                     std::stringstream error_str;
                     error_str << "Attempted copy update to texel buffer descriptor with invalid buffer view: " << buffer_view;
                     *error_msg = error_str.str();