The documentation for this function says that:

Memory is allocated by the function and the caller is responsible for freeing it.

https://www.khronos.org/ktx/documentation/libktx/group__writer.html#ga1e973adc0c1c0d0a6b2c4623c5776079
I tried calling free() on the returned memory and it caused an exception. What is the correct way to delete this memory block?