From 6fc5e5a52cbf8733b62c41c83d0fc6ae777473c9 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 19 Jan 2022 13:08:24 +0100 Subject: [PATCH] lavu/hwcontext_opencl: clear dangling pointers on map failure --- libavutil/hwcontext_opencl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 4e2ab18ede..4f4bd13405 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -2152,6 +2152,7 @@ fail: clReleaseMemObject(mapping->frame.planes[p]); } av_free(mapping); + memset(dst->data, 0, sizeof(dst->data)); return err; } @@ -2329,6 +2330,7 @@ fail: if (desc->planes[p]) clReleaseMemObject(desc->planes[p]); av_freep(&desc); + memset(dst->data, 0, sizeof(dst->data)); return err; } @@ -2419,6 +2421,7 @@ fail: 0, NULL, &event); if (cle == CL_SUCCESS) opencl_wait_events(dst_fc, &event, 1); + memset(dst->data, 0, sizeof(dst->data)); return err; } @@ -2574,6 +2577,7 @@ fail: 0, NULL, &event); if (cle == CL_SUCCESS) opencl_wait_events(dst_fc, &event, 1); + memset(dst->data, 0, sizeof(dst->data)); return err; } @@ -2805,6 +2809,7 @@ fail: clReleaseMemObject(mapping->object_buffers[i]); } av_free(mapping); + memset(dst->data, 0, sizeof(dst->data)); return err; }