Skip to content

Commit

Permalink
Use new[] instead of malloc
Browse files Browse the repository at this point in the history
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
  • Loading branch information
steffenlarsen committed Feb 20, 2024
1 parent 840f94a commit 84cb3bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sycl/test-e2e/InOrderEventsExt/set_external_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int check_work(sycl::queue &Q1, sycl::queue &Q2) {

sycl::buffer<int> DevDataBuf{sycl::range{N}};
sycl::accessor DevData{DevDataBuf};
int *HostData = (int *)malloc(N * sizeof(int) * 10);
int *HostData = new int[N * sizeof(int) * 10];

for (size_t I = 0; I < 10; ++I) {
Q1.fill(DevData, 0);
Expand Down Expand Up @@ -49,7 +49,7 @@ int check_work(sycl::queue &Q1, sycl::queue &Q2) {
}
}
}
free(HostData);
delete[] HostData;
return Failures;
}

Expand All @@ -59,7 +59,7 @@ int check_wait(sycl::queue &Q1, sycl::queue &Q2) {

sycl::buffer<int> DevDataBuf{sycl::range{N}};
sycl::accessor DevData{DevDataBuf};
int *HostData = (int *)malloc(N * sizeof(int));
int *HostData = new int[N * sizeof(int)];

Q1.fill(DevData, 0);
for (size_t I = 0; I < 10; ++I) {
Expand All @@ -83,7 +83,7 @@ int check_wait(sycl::queue &Q1, sycl::queue &Q2) {
++Failures;
}
}
free(HostData);
delete[] HostData;
return Failures;
}

Expand Down

0 comments on commit 84cb3bd

Please sign in to comment.