[FFmpeg-cvslog] vulkan: zero out AVBufferRef in case of failure

Lynne git at videolan.org
Tue Nov 26 15:16:08 EET 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sun Nov 24 17:28:23 2024 +0100| [86e552506dbeee9b43f209d441cfee1e81eb1287] | committer: Lynne

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86e552506dbeee9b43f209d441cfee1e81eb1287
---

 libavutil/vulkan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 5e8d69a297..eaf73eb4fd 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -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;
         }
     }



More information about the ffmpeg-cvslog mailing list