Frameworks: Clean up some possible memory leaks

Change-Id: Iea6acef53483404540ed90d51c047e9fb15076c6