A lot of NRA High Power and CMP shooters put their hand up against the mag on an M-14 or the magwell on an AR for their offhand position, with the elbow down against their rib cage for a solid, bone-on-bone position. This works well if you have no sling (or if the rules prohibit you from using one).
But in a sling-supported position, your hand should be on the forearm, preferably up against the sling swivel, with your elbow under the rifle.
If you're using a supported position, your support side hand should be on the stock.
As for CQB, there are lots of different techniques taught, but I do not favor grabbing the mag/magwell for this. I prefer grabbing the rifle as far forward on the handguard as possible. This gives you better leverage and muzzle control.