Work around a -Wuse-after-free misdetection in GCC 12