(XDK) Properly implement XDK input free function