input: fix crash due to dangling pointer

Wrong API usage, has been in the code since 2011. Rarely triggered (if
at all in the current setup).