Mrmr1993 stop memory leak for keydown repeats

Follow on from #1276.