From ecb7049d7ead022c5f855f69639fdb8f494c4842 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 7 Mar 2019 19:26:56 +0000 Subject: [PATCH] vulkan: fix some leaks Fix vk_instance leak when state change fails like in generic/states unit test. --- ext/vulkan/vkupload.c | 2 ++ ext/vulkan/vkutils.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ext/vulkan/vkupload.c b/ext/vulkan/vkupload.c index ffe963ef90..6a139af64d 100644 --- a/ext/vulkan/vkupload.c +++ b/ext/vulkan/vkupload.c @@ -522,6 +522,8 @@ gst_vulkan_upload_finalize (GObject * object) for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) { upload_methods[i]->free (vk_upload->upload_impls[i]); } + g_free (vk_upload->upload_impls); + vk_upload->upload_impls = NULL; G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/ext/vulkan/vkutils.c b/ext/vulkan/vkutils.c index 1c25cb8122..aaa6bba230 100644 --- a/ext/vulkan/vkutils.c +++ b/ext/vulkan/vkutils.c @@ -247,6 +247,8 @@ gst_vulkan_ensure_element_data (gpointer element, if (!gst_vulkan_instance_open (*instance_ptr, &error)) { GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND, ("Failed to create vulkan instance"), ("%s", error->message)); + gst_object_unref (*instance_ptr); + *instance_ptr = NULL; g_clear_error (&error); return FALSE; } -- 2.34.1