vulkan: zero out AVBufferRef in case of failure

This resulted in uninit errors and was never caught as
we generally did not use massive allocations before.
This commit is contained in:
Lynne 2024-11-24 17:28:23 +01:00
parent f582de8f34
commit 86e552506d
Signed by: Lynne
GPG key ID: A2FEA5F03F034464

View file

@ -1213,6 +1213,8 @@ int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool,
AVBufferRef *ref;
FFVkBuffer *data;
*buf = NULL;
if (!(*buf_pool)) {
*buf_pool = av_buffer_pool_init2(sizeof(FFVkBuffer), ctx,
alloc_data_buf, NULL);
@ -1239,6 +1241,7 @@ int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool,
mem_props);
if (err < 0) {
av_buffer_unref(&ref);
*buf = NULL;
return err;
}
@ -1246,6 +1249,7 @@ int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool,
err = ff_vk_map_buffer(ctx, data, &data->mapped_mem, 0);
if (err < 0) {
av_buffer_unref(&ref);
*buf = NULL;
return err;
}
}