[FFmpeg-cvslog] lavu/hwcontext_opencl: clear dangling pointers on map failure

Anton Khirnov git at videolan.org
Thu Feb 17 12:08:39 EET 2022


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Jan 19 13:08:24 2022 +0100| [6fc5e5a52cbf8733b62c41c83d0fc6ae777473c9] | committer: Anton Khirnov

lavu/hwcontext_opencl: clear dangling pointers on map failure

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

 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;
 }
 



More information about the ffmpeg-cvslog mailing list