@@ -71,12 +71,12 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease(
7171 }
7272 }
7373
74- ur_result_t result = pfnAdapterRelease (hAdapter);
75-
76- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
74+ if (getContext ()->enableLeakChecking ) {
7775 getContext ()->refCountContext ->decrementRefCount (hAdapter, true );
7876 }
7977
78+ ur_result_t result = pfnAdapterRelease (hAdapter);
79+
8080 return result;
8181}
8282
@@ -99,7 +99,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain(
9999
100100 ur_result_t result = pfnAdapterRetain (hAdapter);
101101
102- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
102+ if (getContext ()->enableLeakChecking ) {
103103 getContext ()->refCountContext ->incrementRefCount (hAdapter, true );
104104 }
105105
@@ -558,7 +558,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain(
558558
559559 ur_result_t result = pfnRetain (hDevice);
560560
561- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
561+ if (getContext ()->enableLeakChecking ) {
562562 getContext ()->refCountContext ->incrementRefCount (hDevice, false );
563563 }
564564
@@ -583,12 +583,12 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease(
583583 }
584584 }
585585
586- ur_result_t result = pfnRelease (hDevice);
587-
588- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
586+ if (getContext ()->enableLeakChecking ) {
589587 getContext ()->refCountContext ->decrementRefCount (hDevice, false );
590588 }
591589
590+ ur_result_t result = pfnRelease (hDevice);
591+
592592 return result;
593593}
594594
@@ -861,7 +861,7 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain(
861861
862862 ur_result_t result = pfnRetain (hContext);
863863
864- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
864+ if (getContext ()->enableLeakChecking ) {
865865 getContext ()->refCountContext ->incrementRefCount (hContext, false );
866866 }
867867
@@ -886,12 +886,12 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease(
886886 }
887887 }
888888
889- ur_result_t result = pfnRelease (hContext);
890-
891- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
889+ if (getContext ()->enableLeakChecking ) {
892890 getContext ()->refCountContext ->decrementRefCount (hContext, false );
893891 }
894892
893+ ur_result_t result = pfnRelease (hContext);
894+
895895 return result;
896896}
897897
@@ -1248,7 +1248,7 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain(
12481248
12491249 ur_result_t result = pfnRetain (hMem);
12501250
1251- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
1251+ if (getContext ()->enableLeakChecking ) {
12521252 getContext ()->refCountContext ->incrementRefCount (hMem, false );
12531253 }
12541254
@@ -1273,12 +1273,12 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease(
12731273 }
12741274 }
12751275
1276- ur_result_t result = pfnRelease (hMem);
1277-
1278- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
1276+ if (getContext ()->enableLeakChecking ) {
12791277 getContext ()->refCountContext ->decrementRefCount (hMem, false );
12801278 }
12811279
1280+ ur_result_t result = pfnRelease (hMem);
1281+
12821282 return result;
12831283}
12841284
@@ -1657,7 +1657,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain(
16571657
16581658 ur_result_t result = pfnRetain (hSampler);
16591659
1660- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
1660+ if (getContext ()->enableLeakChecking ) {
16611661 getContext ()->refCountContext ->incrementRefCount (hSampler, false );
16621662 }
16631663
@@ -1682,12 +1682,12 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease(
16821682 }
16831683 }
16841684
1685- ur_result_t result = pfnRelease (hSampler);
1686-
1687- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
1685+ if (getContext ()->enableLeakChecking ) {
16881686 getContext ()->refCountContext ->decrementRefCount (hSampler, false );
16891687 }
16901688
1689+ ur_result_t result = pfnRelease (hSampler);
1690+
16911691 return result;
16921692}
16931693
@@ -2154,7 +2154,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain(
21542154
21552155 ur_result_t result = pfnPoolRetain (pPool);
21562156
2157- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
2157+ if (getContext ()->enableLeakChecking ) {
21582158 getContext ()->refCountContext ->incrementRefCount (pPool, false );
21592159 }
21602160
@@ -2178,12 +2178,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease(
21782178 }
21792179 }
21802180
2181- ur_result_t result = pfnPoolRelease (pPool);
2182-
2183- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
2181+ if (getContext ()->enableLeakChecking ) {
21842182 getContext ()->refCountContext ->decrementRefCount (pPool, false );
21852183 }
21862184
2185+ ur_result_t result = pfnPoolRelease (pPool);
2186+
21872187 return result;
21882188}
21892189
@@ -2631,7 +2631,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain(
26312631
26322632 ur_result_t result = pfnRetain (hPhysicalMem);
26332633
2634- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
2634+ if (getContext ()->enableLeakChecking ) {
26352635 getContext ()->refCountContext ->incrementRefCount (hPhysicalMem, false );
26362636 }
26372637
@@ -2656,12 +2656,12 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease(
26562656 }
26572657 }
26582658
2659- ur_result_t result = pfnRelease (hPhysicalMem);
2660-
2661- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
2659+ if (getContext ()->enableLeakChecking ) {
26622660 getContext ()->refCountContext ->decrementRefCount (hPhysicalMem, false );
26632661 }
26642662
2663+ ur_result_t result = pfnRelease (hPhysicalMem);
2664+
26652665 return result;
26662666}
26672667
@@ -2952,7 +2952,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain(
29522952
29532953 ur_result_t result = pfnRetain (hProgram);
29542954
2955- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
2955+ if (getContext ()->enableLeakChecking ) {
29562956 getContext ()->refCountContext ->incrementRefCount (hProgram, false );
29572957 }
29582958
@@ -2977,12 +2977,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease(
29772977 }
29782978 }
29792979
2980- ur_result_t result = pfnRelease (hProgram);
2981-
2982- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
2980+ if (getContext ()->enableLeakChecking ) {
29832981 getContext ()->refCountContext ->decrementRefCount (hProgram, false );
29842982 }
29852983
2984+ ur_result_t result = pfnRelease (hProgram);
2985+
29862986 return result;
29872987}
29882988
@@ -3618,7 +3618,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
36183618
36193619 ur_result_t result = pfnRetain (hKernel);
36203620
3621- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
3621+ if (getContext ()->enableLeakChecking ) {
36223622 getContext ()->refCountContext ->incrementRefCount (hKernel, false );
36233623 }
36243624
@@ -3643,12 +3643,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease(
36433643 }
36443644 }
36453645
3646- ur_result_t result = pfnRelease (hKernel);
3647-
3648- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
3646+ if (getContext ()->enableLeakChecking ) {
36493647 getContext ()->refCountContext ->decrementRefCount (hKernel, false );
36503648 }
36513649
3650+ ur_result_t result = pfnRelease (hKernel);
3651+
36523652 return result;
36533653}
36543654
@@ -4138,7 +4138,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain(
41384138
41394139 ur_result_t result = pfnRetain (hQueue);
41404140
4141- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
4141+ if (getContext ()->enableLeakChecking ) {
41424142 getContext ()->refCountContext ->incrementRefCount (hQueue, false );
41434143 }
41444144
@@ -4163,12 +4163,12 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease(
41634163 }
41644164 }
41654165
4166- ur_result_t result = pfnRelease (hQueue);
4167-
4168- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
4166+ if (getContext ()->enableLeakChecking ) {
41694167 getContext ()->refCountContext ->decrementRefCount (hQueue, false );
41704168 }
41714169
4170+ ur_result_t result = pfnRelease (hQueue);
4171+
41724172 return result;
41734173}
41744174
@@ -4454,7 +4454,7 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain(
44544454
44554455 ur_result_t result = pfnRetain (hEvent);
44564456
4457- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS ) {
4457+ if (getContext ()->enableLeakChecking ) {
44584458 getContext ()->refCountContext ->incrementRefCount (hEvent, false );
44594459 }
44604460
@@ -4478,12 +4478,12 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease(
44784478 }
44794479 }
44804480
4481- ur_result_t result = pfnRelease (hEvent);
4482-
4483- if (getContext ()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
4481+ if (getContext ()->enableLeakChecking ) {
44844482 getContext ()->refCountContext ->decrementRefCount (hEvent, false );
44854483 }
44864484
4485+ ur_result_t result = pfnRelease (hEvent);
4486+
44874487 return result;
44884488}
44894489
0 commit comments