As Spell Combat specifies:
"... A magus can choose to cast the spell first or make the weapon attacks first, but he cannot cast the spell between weapon attacks if he has more than one attack."
It takes two hands to attack with a greatsword but I wouldn't imagine you'd need both hands on it before and after. Its cast THEN attack (or vice versa) so why do you always need a free hand?