Fixed a major memory leak caused by the return exception causing a memory object not to be freed within the if statement.