Merge "Prevent memory corruption from use-after-free" into lmp-mr1-dev