Merge "Fix potential use-after-free issue" into rvc-dev am: 557bdaa8d2 am: 43c67d5cce

Change-Id: If049eb5344f98fe2e0a9b8b4c0c29c2a1a9362ca