The configuration you describe can result in as much as 40 amps on the #10 neutral, which is only allowed to carry 30 amps. So, yes, the installation is unsafe, and in violation of code.