KAA-217: Use KAA_FREE macros instead of the equivalent function to reduce the code complexity.