Fixes segv inside rule swap under low mem conditions.

We now gracefully exit rule swap on any allocation or other failures.