Fix issue with freeing allocation with circular references.

Change-Id: I45871c20a192815eafee77f95e17a025f6dcf9d1
7 files changed