Skip to content

Commit

Permalink
Scene: fix use-after-free in accel_release_gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinND authored and wjakob committed Feb 2, 2024
1 parent 9b07330 commit 0bcfc72
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/render/scene_optix.inl
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,6 @@ MI_VARIANT void Scene<Float, Spectrum>::accel_release_gpu() {
// Ensure all ray tracing kernels are terminated before releasing the scene
dr::sync_thread();

/* Decrease the reference count of the IAS handle variable. This will
trigger the release of the OptiX acceleration data structure if no
ray tracing calls are pending. */
m_accel_handle = 0;

OptixSceneState *s = (OptixSceneState *) m_accel;

if (s->own_sbt) {
Expand All @@ -567,6 +562,11 @@ MI_VARIANT void Scene<Float, Spectrum>::accel_release_gpu() {
(void) UInt32::steal(s->sbt_jit_index);
}
m_accel = nullptr;

/* Decrease the reference count of the IAS handle variable. This will
trigger the release of the OptiX acceleration data structure if no
ray tracing calls are pending. */
m_accel_handle = 0;
}
}

Expand Down

0 comments on commit 0bcfc72

Please sign in to comment.