vulkan/swapper: set some values to NULL in error conditions

So that they are not double free()-ed.
This commit is contained in:
Matthew Waters 2019-08-23 14:17:02 +10:00
parent d9248560e4
commit cac1487479

View file

@ -855,6 +855,7 @@ _swapchain_resize (GstVulkanSwapper * swapper, GError ** error)
gst_memory_unref ((GstMemory *) swapper->priv->swap_chain_images[i]); gst_memory_unref ((GstMemory *) swapper->priv->swap_chain_images[i]);
} }
g_free (swapper->priv->swap_chain_images); g_free (swapper->priv->swap_chain_images);
swapper->priv->swap_chain_images = NULL;
} }
return _allocate_swapchain (swapper, swapper->priv->caps, error); return _allocate_swapchain (swapper, swapper->priv->caps, error);
@ -1166,6 +1167,7 @@ reacquire:
GST_DEBUG_OBJECT (swapper, "out of date frame acquired"); GST_DEBUG_OBJECT (swapper, "out of date frame acquired");
vkDestroySemaphore (swapper->device->device, acquire_semaphore, NULL); vkDestroySemaphore (swapper->device->device, acquire_semaphore, NULL);
acquire_semaphore = NULL;
if (!_swapchain_resize (swapper, error)) if (!_swapchain_resize (swapper, error))
goto error; goto error;
goto reacquire; goto reacquire;
@ -1215,6 +1217,7 @@ reacquire:
swapper->cmd_pool, cmd)); swapper->cmd_pool, cmd));
gst_vulkan_trash_list_add (swapper->priv->trash_list, gst_vulkan_trash_list_add (swapper->priv->trash_list,
gst_vulkan_trash_new_free_semaphore (fence, acquire_semaphore)); gst_vulkan_trash_new_free_semaphore (fence, acquire_semaphore));
acquire_semaphore = NULL;
cmd = VK_NULL_HANDLE; cmd = VK_NULL_HANDLE;
fence = NULL; fence = NULL;