Forgot to commit last phase and fix : memory leak check. The whole memory is freed. You can use valgrind for this