logoalt Hacker News

NobodyNada • today at 3:53 PM • 0 replies • view on HN

The error is the destructor of `q` could look at the reference and stash it away somewhere, like a global variable (since the compiler thinks the reference is valid forever). Then, some other part of the program could access that variable and cause a UAF.