cmd_{click,mouse*}: fix memleaks

Caught by clang static analyzer: Memory leak.

cmd_mousedown.c is a copy of cmd_mouseup.c with "up" replaced by "down"
and one different error message. The other files follow the same pattern
of changes.

While at it, fix up some trailing whitespace.