Merge "Fix potential use-after-free issue" into oc-dev