When using the Azure Kinect SDK on branch release/1.3.x, I have found the following issues when compiling with Address Sanitizer-fsanitize=address
My CMakeLists.txt is as follows
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
add_executable(k4a_test test.cpp)
target_link_libraries(k4a_test PRIVATE k4a::k4a)
Error 1: libusb issue when using k4a_device_open
This issue doesn't happen consistently but it does happen frequently
Example Kinect Calls
k4a_device_t device = nullptr;
if (K4A_RESULT_SUCCEEDED != k4a_device_open(K4A_DEVICE_DEFAULT, &device))
{
std::cout << "Failed to open device" << std::endl;
return EXIT_FAILURE;
}
k4a_device_close(device);
Address Sanitizer Output
=================================================================
==27561==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 152 byte(s) in 1 object(s) allocated from:
#0 0x7fdc2372313e in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10c13e)
#1 0x7fdc233a4075 in usbi_alloc_device ../extern/libusb/src/libusb/core.c:677
Direct leak of 56 byte(s) in 1 object(s) allocated from:
#0 0x7fdc2372313e in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10c13e)
#1 0x7fdc233ab952 in submit_bulk_transfer ../extern/libusb/src/libusb/os/linux_usbfs.c:1934
Indirect leak of 3072 byte(s) in 3 object(s) allocated from:
#0 0x7fdc2372337e in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10c37e)
#1 0x7fdc233aea7d in usbi_reallocf ../extern/libusb/src/libusb/libusbi.h:171
#2 0x7fdc233aea7d in initialize_device ../extern/libusb/src/libusb/os/linux_usbfs.c:991
#3 0x7fdc233aea7d in linux_enumerate_device ../extern/libusb/src/libusb/os/linux_usbfs.c:1146
Indirect leak of 304 byte(s) in 2 object(s) allocated from:
#0 0x7fdc2372313e in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10c13e)
#1 0x7fdc233a4075 in usbi_alloc_device ../extern/libusb/src/libusb/core.c:677
Indirect leak of 15 byte(s) in 3 object(s) allocated from:
#0 0x7fdc236abccd in __interceptor_strdup (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x94ccd)
#1 0x7fdc233ae9b0 in initialize_device ../extern/libusb/src/libusb/os/linux_usbfs.c:961
#2 0x7fdc233ae9b0 in linux_enumerate_device ../extern/libusb/src/libusb/os/linux_usbfs.c:1146
SUMMARY: AddressSanitizer: 3599 byte(s) leaked in 10 allocation(s).
Error 2: Issue when creating transformation using k4a_transformation_create
When src/sdk/k4a.c has TRANSFORM_ENABLE_GPU_OPTIMIZATION defined as true, it would give the below issues but if TRANSFORM_ENABLE_GPU_OPTIMIZATION is defined as false, the issue will not occur
When using the Azure Kinect SDK on branch release/1.3.x, I have found the following issues when compiling with Address Sanitizer
-fsanitize=address
My CMakeLists.txt is as follows
Error 1: libusb issue when using k4a_device_open
This issue doesn't happen consistently but it does happen frequently
Example Kinect Calls
Address Sanitizer Output
Logs
error1.log
Error 2: Issue when creating transformation using k4a_transformation_create
When
src/sdk/k4a.c
hasTRANSFORM_ENABLE_GPU_OPTIMIZATION
defined astrue
, it would give the below issues but ifTRANSFORM_ENABLE_GPU_OPTIMIZATION
is defined asfalse
, the issue will not occurExample Program
Address Sanitizer Output
Logs
error2.log
Desktop Information
Edit Note: Added missing summary line for error 2