Merge "Fix potential memory leak." into pi-dev am: f4b75c9ad8
am: b0969388d8

Change-Id: I726cdf8c6fd600503872ea930dbd1f89909acb56