[2426] Fix leak of GenericImpl object when an exception is thrown