@@ -5895,7 +5895,7 @@ urBindlessImagesUnsampledImageHandleDestroyExp(
58955895 ur_context_handle_t hContext, // /< [in] handle of the context object
58965896 ur_device_handle_t hDevice, // /< [in] handle of the device object
58975897 ur_exp_image_handle_t
5898- hImage // /< [in] pointer to handle of image object to destroy
5898+ hImage // /< [in][release] pointer to handle of image object to destroy
58995899) {
59005900 ur_result_t result = UR_RESULT_SUCCESS;
59015901
@@ -5919,6 +5919,13 @@ urBindlessImagesUnsampledImageHandleDestroyExp(
59195919 // forward to device-platform
59205920 result = pfnUnsampledImageHandleDestroyExp (hContext, hDevice, hImage);
59215921
5922+ if (UR_RESULT_SUCCESS != result) {
5923+ return result;
5924+ }
5925+
5926+ // release loader handle
5927+ ur_exp_image_factory.release (hImage);
5928+
59225929 return result;
59235930}
59245931
@@ -5929,7 +5936,7 @@ urBindlessImagesSampledImageHandleDestroyExp(
59295936 ur_context_handle_t hContext, // /< [in] handle of the context object
59305937 ur_device_handle_t hDevice, // /< [in] handle of the device object
59315938 ur_exp_image_handle_t
5932- hImage // /< [in] pointer to handle of image object to destroy
5939+ hImage // /< [in][release] pointer to handle of image object to destroy
59335940) {
59345941 ur_result_t result = UR_RESULT_SUCCESS;
59355942
@@ -5953,6 +5960,13 @@ urBindlessImagesSampledImageHandleDestroyExp(
59535960 // forward to device-platform
59545961 result = pfnSampledImageHandleDestroyExp (hContext, hDevice, hImage);
59555962
5963+ if (UR_RESULT_SUCCESS != result) {
5964+ return result;
5965+ }
5966+
5967+ // release loader handle
5968+ ur_exp_image_factory.release (hImage);
5969+
59565970 return result;
59575971}
59585972
@@ -6542,7 +6556,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp(
65426556 ur_context_handle_t hContext, // /< [in] handle of the context object
65436557 ur_device_handle_t hDevice, // /< [in] handle of the device object
65446558 ur_exp_interop_semaphore_handle_t
6545- hInteropSemaphore // /< [in] handle of interop semaphore to be destroyed
6559+ hInteropSemaphore // /< [in][release] handle of interop semaphore to be destroyed
65466560) {
65476561 ur_result_t result = UR_RESULT_SUCCESS;
65486562
@@ -6569,6 +6583,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp(
65696583 result =
65706584 pfnDestroyExternalSemaphoreExp (hContext, hDevice, hInteropSemaphore);
65716585
6586+ if (UR_RESULT_SUCCESS != result) {
6587+ return result;
6588+ }
6589+
6590+ // release loader handle
6591+ ur_exp_interop_semaphore_factory.release (hInteropSemaphore);
6592+
65726593 return result;
65736594}
65746595
0 commit comments