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.
This commit is contained in:
Mark Thompson 2018-11-25 19:14:27 +00:00
parent 8cc5107705
commit b9aff7a53d

@ -1726,11 +1726,14 @@ static void opencl_frames_uninit(AVHWFramesContext *hwfc)
av_freep(&priv->mapped_frames); av_freep(&priv->mapped_frames);
#endif #endif
if (priv->command_queue) {
cle = clReleaseCommandQueue(priv->command_queue); cle = clReleaseCommandQueue(priv->command_queue);
if (cle != CL_SUCCESS) { if (cle != CL_SUCCESS) {
av_log(hwfc, AV_LOG_ERROR, "Failed to release frame " av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
"command queue: %d.\n", cle); "command queue: %d.\n", cle);
} }
priv->command_queue = NULL;
}
} }
static int opencl_get_buffer(AVHWFramesContext *hwfc, AVFrame *frame) static int opencl_get_buffer(AVHWFramesContext *hwfc, AVFrame *frame)