Fixing memory leaks in input framework.