fix: memory leaks in factorization
Merge pull request #367 from mmklee/memory_sw

fix: memory leaks in factorization