Fixed memory leaking due to unfreed fields