summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2020-11-22 22:56:33 +0100
committerLynne <dev@lynne.ee>2020-11-25 23:06:35 +0100
commit10b3c9b533d9beb5cff732fa57011fcb182ea17d (patch)
treefc997b6768f5f9b88050a57ed46560e3d945b7c8 /libavutil
parentae8fc9922eb51ce8628f3e3333d1fe817518ca76 (diff)
hwcontext_vulkan: do not use uninitialized variables on errors in CUDA code
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/hwcontext_vulkan.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index a98ea916e7..ed39e7b8ea 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -2409,17 +2409,17 @@ static int vulkan_transfer_data_from_cuda(AVHWFramesContext *hwfc,
CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS s_s_par[AV_NUM_DATA_POINTERS] = { 0 };
ret = CHECK_CU(cu->cuCtxPushCurrent(cuda_dev->cuda_ctx));
- if (ret < 0) {
- err = AVERROR_EXTERNAL;
- goto fail;
- }
+ if (ret < 0)
+ return AVERROR_EXTERNAL;
dst_f = (AVVkFrame *)dst->data[0];
ret = vulkan_export_to_cuda(hwfc, src->hw_frames_ctx, dst);
if (ret < 0) {
- goto fail;
+ CHECK_CU(cu->cuCtxPopCurrent(&dummy));
+ return ret;
}
+
dst_int = dst_f->internal;
ret = CHECK_CU(cu->cuWaitExternalSemaphoresAsync(dst_int->cu_sem, s_w_par,
@@ -3120,16 +3120,15 @@ static int vulkan_transfer_data_to_cuda(AVHWFramesContext *hwfc, AVFrame *dst,
CudaFunctions *cu = cu_internal->cuda_dl;
ret = CHECK_CU(cu->cuCtxPushCurrent(cuda_dev->cuda_ctx));
- if (ret < 0) {
- err = AVERROR_EXTERNAL;
- goto fail;
- }
+ if (ret < 0)
+ return AVERROR_EXTERNAL;
dst_f = (AVVkFrame *)src->data[0];
err = vulkan_export_to_cuda(hwfc, dst->hw_frames_ctx, src);
if (err < 0) {
- goto fail;
+ CHECK_CU(cu->cuCtxPopCurrent(&dummy));
+ return err;
}
dst_int = dst_f->internal;