mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
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:
parent
f582de8f34
commit
86e552506d
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user