layers: Free per-device and -instance data on destroy

Instance and device data are allocated by the first call to
GetLayerDataPtr in the corresponding vkCreate call. We need to delete
them when we're done with them. Introduce a FreeLayerDataPtr helper
function that assists with this task.

Deletes for dispatch tables were missing in a few places too. Add them.
diff --git a/layers/threading.cpp b/layers/threading.cpp
index 5984c4c..7808a81 100644
--- a/layers/threading.cpp
+++ b/layers/threading.cpp
@@ -121,7 +121,7 @@
 
     layer_debug_report_destroy_instance(my_data->report_data);
     delete my_data->instance_dispatch_table;
-    layer_data_map.erase(key);
+    FreeLayerDataPtr(key, layer_data_map);
 }
 
 VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo,
@@ -168,7 +168,9 @@
     } else {
         finishMultiThread();
     }
-    layer_data_map.erase(key);
+
+    delete dev_data->device_dispatch_table;
+    FreeLayerDataPtr(key, layer_data_map);
 }
 
 VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount,