CVE-2024-38588 ftrace: Fix possible use-after-free issue in ftrace_location()