I'm pretty sure this topic has already been brought up, but has anybody considered that Malavai simply did the betrayal to save face? So if he failed, Baras wouldn't come after him? He's ran with you for a long time - he would know that his machines would fail.
I haven't experienced this part of my SW's storyline yet, so I don't know the dialogue options that exist. But maybe Malavai purposefully failed, knowing you well enough so that you wouldn't kill him, while maintaining his position under Baras.