Ticket #2119: Fixed memory leaks in command_completion_function() function.