vulkan: fix some leaks

Fix vk_instance leak when state change fails like in
generic/states unit test.
This commit is contained in:
Tim-Philipp Müller 2019-03-07 19:26:56 +00:00
parent c930c42aa8
commit ecb7049d7e
2 changed files with 4 additions and 0 deletions

View file

@ -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);
}

View file

@ -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;
}