If you gain control of a permanent, and you leave the game, the control-changing effect will end. Unless there's another control-changing effect affecting that permanent, it will return to its owner's control.