Fixed multiple memory leaks in function authenticationHeaders