@@ -6008,7 +6008,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp(
60086008 ur_context_handle_t hContext, // /< [in] handle of the context object
60096009 ur_device_handle_t hDevice, // /< [in] handle of the device object
60106010 ur_exp_image_mem_handle_t
6011- hImageMem // /< [in] handle of image memory to be freed
6011+ hImageMem // /< [in][release] handle of image memory to be freed
60126012) {
60136013 ur_result_t result = UR_RESULT_SUCCESS;
60146014
@@ -6032,6 +6032,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp(
60326032 // forward to device-platform
60336033 result = pfnImageFreeExp (hContext, hDevice, hImageMem);
60346034
6035+ if (UR_RESULT_SUCCESS != result) {
6036+ return result;
6037+ }
6038+
6039+ // release loader handle
6040+ ur_exp_image_mem_factory.release (hImageMem);
6041+
60356042 return result;
60366043}
60376044
@@ -6302,9 +6309,10 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp(
63026309// /////////////////////////////////////////////////////////////////////////////
63036310// / @brief Intercept function for urBindlessImagesMipmapFreeExp
63046311__urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp (
6305- ur_context_handle_t hContext, // /< [in] handle of the context object
6306- ur_device_handle_t hDevice, // /< [in] handle of the device object
6307- ur_exp_image_mem_handle_t hMem // /< [in] handle of image memory to be freed
6312+ ur_context_handle_t hContext, // /< [in] handle of the context object
6313+ ur_device_handle_t hDevice, // /< [in] handle of the device object
6314+ ur_exp_image_mem_handle_t
6315+ hMem // /< [in][release] handle of image memory to be freed
63086316) {
63096317 ur_result_t result = UR_RESULT_SUCCESS;
63106318
@@ -6327,6 +6335,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp(
63276335 // forward to device-platform
63286336 result = pfnMipmapFreeExp (hContext, hDevice, hMem);
63296337
6338+ if (UR_RESULT_SUCCESS != result) {
6339+ return result;
6340+ }
6341+
6342+ // release loader handle
6343+ ur_exp_image_mem_factory.release (hMem);
6344+
63306345 return result;
63316346}
63326347
0 commit comments