Merge "Fix UAF error caught by asan"