Merge "Fix potential memory leak." am: 89bdf3ae71
am: 5c86ca4a50

Change-Id: Ia40481c763a1257737b354fa772ba77d53691235