Skip to content

Commit

Permalink
Fix mismatched calloc/free function in ubpf_user.c
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler committed Aug 13, 2023
1 parent 97b3f5a commit e6028cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libs/ubpf/user/ubpf_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#include <endian.h>
#define UBPF_STACK_SIZE 512

#include <stdlib.h>

#define malloc(X) ebpf_allocate((X))
#define calloc(X, Y) ebpf_allocate((X) * (Y))
#define free(X) ebpf_free(X)

#pragma warning(push)
#pragma warning(disable : 4100) // unreferenced formal parameter
#pragma warning(disable : 4211) // nonstandard extension used: redefined extern to static
Expand Down
2 changes: 2 additions & 0 deletions tests/bpf2c_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ target_link_libraries("bpf2c_tests" PRIVATE
"bpf2c_driver"
"bpf2c_dll"
"ubpf_user"
"platform_user"
"usersim"
"Mincore.lib"
)

Expand Down
6 changes: 6 additions & 0 deletions tests/bpf2c_tests/bpf2c_tests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,15 @@
<ProjectReference Include="..\..\external\ebpf-verifier\build\ebpfverifier.vcxproj">
<Project>{7d5b4e68-c0fa-3f86-9405-f6400219b440}</Project>
</ProjectReference>
<ProjectReference Include="..\..\external\usersim\src\usersim.vcxproj">
<Project>{030a7ac6-14dc-45cf-af34-891057ab1402}</Project>
</ProjectReference>
<ProjectReference Include="..\..\libs\elf_spec\elf_spec.vcxproj">
<Project>{c3d2cd73-bf4c-47df-8808-2a9996124d5b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\libs\platform\user\platform_user.vcxproj">
<Project>{c26cb6a9-158c-4a9e-a243-755ddd98e5fe}</Project>
</ProjectReference>
<ProjectReference Include="..\libs\util\test_util.vcxproj">
<Project>{d6725f19-b9bf-435f-80f2-c5f3ef0f4b8f}</Project>
</ProjectReference>
Expand Down

0 comments on commit e6028cc

Please sign in to comment.