@@ -4069,7 +4069,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4069
4069
cl_event local_event = 0 ;
4070
4070
unsigned int physical_id;
4071
4071
unsigned int mem_id;
4072
- int *needs_release_on_fail;
4073
4072
4074
4073
std::scoped_lock lock{acl_mutex_wrapper};
4075
4074
@@ -4114,10 +4113,7 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4114
4113
4115
4114
// Try to reserve space for all the buffers to be moved. If we fail, we need
4116
4115
// to know which buffers to deallocate:
4117
- needs_release_on_fail = (int *)malloc (sizeof (int ) * num_mem_objects);
4118
- for (i = 0 ; i < num_mem_objects; ++i) {
4119
- needs_release_on_fail[i] = 0 ;
4120
- }
4116
+ std::vector<bool > needs_release_on_fail (num_mem_objects, false );
4121
4117
4122
4118
status = CL_SUCCESS;
4123
4119
for (i = 0 ; i < num_mem_objects; ++i) {
@@ -4132,7 +4128,7 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4132
4128
status = CL_MEM_OBJECT_ALLOCATION_FAILURE;
4133
4129
break ;
4134
4130
}
4135
- needs_release_on_fail[i] = 1 ;
4131
+ needs_release_on_fail[i] = true ;
4136
4132
}
4137
4133
mem_objects[i]->reserved_allocations_count [physical_id][mem_id]++;
4138
4134
}
@@ -4148,7 +4144,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4148
4144
}
4149
4145
mem_objects[i]->reserved_allocations_count [physical_id][mem_id]--;
4150
4146
}
4151
- free (needs_release_on_fail);
4152
4147
return status;
4153
4148
}
4154
4149
@@ -4159,7 +4154,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4159
4154
CL_COMMAND_MIGRATE_MEM_OBJECTS, &local_event);
4160
4155
4161
4156
if (status != CL_SUCCESS) {
4162
- free (needs_release_on_fail);
4163
4157
return status; // already signalled callback
4164
4158
}
4165
4159
@@ -4205,8 +4199,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4205
4199
acl_idle_update (command_queue->context ); // Clean up early
4206
4200
}
4207
4201
4208
- free (needs_release_on_fail);
4209
-
4210
4202
return CL_SUCCESS;
4211
4203
}
4212
4204
0 commit comments