History

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.

Lynne committed 1 year ago

Commit 86e55251 parent f582de81 file · +4 −0Browse files

Unified · Split

libavutil/vulkan.c+4−0
@@ -1213,6 +1213,8 @@ int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool, · 1212 unmodified lines
12131213 AVBufferRef *ref;
12141214 FFVkBuffer *data;
12151215
1216+ *buf = NULL;
1217+
12161218 if (!(*buf_pool)) {
12171219 *buf_pool = av_buffer_pool_init2(sizeof(FFVkBuffer), ctx,
12181220 alloc_data_buf, NULL);
@@ -1239,6 +1241,7 @@ int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool, · 20 unmodified lines
12391241 mem_props);
12401242 if (err < 0) {
12411243 av_buffer_unref(&ref);
1244+ *buf = NULL;
12421245 return err;
12431246 }
12441247
@@ -1246,6 +1249,7 @@ int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool, · 1 unmodified line
12461249 err = ff_vk_map_buffer(ctx, data, &data->mapped_mem, 0);
12471250 if (err < 0) {
12481251 av_buffer_unref(&ref);
1252+ *buf = NULL;
12491253 return err;
12501254 }
12511255 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t