> commit 3257feba101053b0b3689147c1a8850f68448f62 > Author: Lynne <d...@lynne.ee> > Date: Sun Dec 18 08:31:03 2022 +0100 > > libavcodec: add Vulkan common video code > > +static AVBufferRef *alloc_data_buf(void *opaque, size_t size) > +{ > + uint8_t *buf = av_mallocz(size); > + if (!buf) > + return NULL; > + > + return av_buffer_create(buf, size, free_data_buf, opaque, 0);
leaks buf on av_buffer_create() failure. > +av_cold int ff_vk_video_common_init(void *log, FFVulkanContext *s, > + FFVkVideoCommon *common, > + VkVideoSessionCreateInfoKHR > *session_create) > +{ > + int err; > + VkResult ret; > + FFVulkanFunctions *vk = &s->vkfn; > + VkMemoryRequirements2 *mem_req = NULL; > + VkVideoSessionMemoryRequirementsKHR *mem = NULL; > + VkBindVideoSessionMemoryInfoKHR *bind_mem = NULL; > + > + /* Create session */ > + ret = vk->CreateVideoSessionKHR(s->hwctx->act_dev, session_create, > + s->hwctx->alloc, &common->session); > + if (ret != VK_SUCCESS) > + return AVERROR_EXTERNAL; > + > + /* Get memory requirements */ > + ret = vk->GetVideoSessionMemoryRequirementsKHR(s->hwctx->act_dev, > + common->session, > + &common->nb_mem, > + NULL); > + if (ret != VK_SUCCESS) { > + err = AVERROR_EXTERNAL; > + goto fail; > + } > + > + /* Allocate all memory needed to actually allocate memory */ > + common->mem = av_mallocz(sizeof(*common->mem)*common->nb_mem); av_calloc(), same below -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".