Fixing memory leaks in default solver