Bugfix: calculate proper size for memset()

The proper idiom is:

  memset(ptr, val, sizeof(*ptr));

These files were using:

  memset(ptr, val, sizeof(ptr));
bugfix: motion.c: calculate proper allocation size

The proper idiom for calculating the size for memory allocation is:

  ptr = malloc(sizeof(*ptr));

The sizeof() dereferences the pointer's type, and allocates enough
memory to store an instance of that type. motion.c was using this idiom:

  ptr = malloc(sizeof(ptr));

This is incorrect, but thankfully fairly harmless in practice since the
pointer type is usually quite large. Change this to the proper idiom.