lavu/hwcontext_opencl: clear dangling pointers on map failure

This commit is contained in:
Anton Khirnov 2022-01-19 13:08:24 +01:00
parent 881b80ffcf
commit 6fc5e5a52c
1 changed files with 5 additions and 0 deletions

View File

@ -2152,6 +2152,7 @@ fail:
clReleaseMemObject(mapping->frame.planes[p]); clReleaseMemObject(mapping->frame.planes[p]);
} }
av_free(mapping); av_free(mapping);
memset(dst->data, 0, sizeof(dst->data));
return err; return err;
} }
@ -2329,6 +2330,7 @@ fail:
if (desc->planes[p]) if (desc->planes[p])
clReleaseMemObject(desc->planes[p]); clReleaseMemObject(desc->planes[p]);
av_freep(&desc); av_freep(&desc);
memset(dst->data, 0, sizeof(dst->data));
return err; return err;
} }
@ -2419,6 +2421,7 @@ fail:
0, NULL, &event); 0, NULL, &event);
if (cle == CL_SUCCESS) if (cle == CL_SUCCESS)
opencl_wait_events(dst_fc, &event, 1); opencl_wait_events(dst_fc, &event, 1);
memset(dst->data, 0, sizeof(dst->data));
return err; return err;
} }
@ -2574,6 +2577,7 @@ fail:
0, NULL, &event); 0, NULL, &event);
if (cle == CL_SUCCESS) if (cle == CL_SUCCESS)
opencl_wait_events(dst_fc, &event, 1); opencl_wait_events(dst_fc, &event, 1);
memset(dst->data, 0, sizeof(dst->data));
return err; return err;
} }
@ -2805,6 +2809,7 @@ fail:
clReleaseMemObject(mapping->object_buffers[i]); clReleaseMemObject(mapping->object_buffers[i]);
} }
av_free(mapping); av_free(mapping);
memset(dst->data, 0, sizeof(dst->data));
return err; return err;
} }