summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-11-25 19:14:27 +0000
committerMark Thompson <sw@jkqxz.net>2018-11-28 00:05:09 +0000
commitb9aff7a53d598a7882bfe3db449a3e5dc6543f05 (patch)
treee309e58d9b4e4a71892d1d3d99f583b444c98944
parent8cc5107705e9d5758702075ad8f0473063f7f740 (diff)
hwcontext_opencl: Only release command queue if it exists
If the frames context creation fails then the command queue reference need not exist when uninit is called.
-rw-r--r--libavutil/hwcontext_opencl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 728877553f..be71c8323e 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -1726,10 +1726,13 @@ static void opencl_frames_uninit(AVHWFramesContext *hwfc)
av_freep(&priv->mapped_frames);
#endif
- cle = clReleaseCommandQueue(priv->command_queue);
- if (cle != CL_SUCCESS) {
- av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
- "command queue: %d.\n", cle);
+ if (priv->command_queue) {
+ cle = clReleaseCommandQueue(priv->command_queue);
+ if (cle != CL_SUCCESS) {
+ av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
+ "command queue: %d.\n", cle);
+ }
+ priv->command_queue = NULL;
}
}