lavu/hwcontext_opencl: clear dangling pointers on map failure

release/5.1
Anton Khirnov 3 years ago
parent 881b80ffcf
commit 6fc5e5a52c
  1. 5
      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;
}

Loading…
Cancel
Save