Sometimes (at least in principle) God might allow some evil because doing so will prevent a greater evil, and sometimes He might allow evil because it will produce a greater good.