sackmotion/motion — pull request #20 by aklomp (2014-05-03 18:49:14+00:00)
Title: Fix incorrect sizeof() calculations in malloc and memset

The proper idiom for calculating an image's memory size from a pointer using `sizeof()` is:

```c
ptr = malloc(width * height * sizeof(*ptr));
```
The sizeof() dereferences the pointer's type, and allocates enough memory to store an image's worth of elements of that type. However, Motion was occasionally using this pattern:

```c
ptr = malloc(width * height * sizeof(ptr));
```

Not dereferencing the pointer, this uses the storage size of *the pointer itself*, not its target type, for the calculation. While this is probably not immediately harmful since pointers tend to be large, it is incorrect. This pull request fixes a number of these issues.