Eliminated malloc in code.

Removes the malloc in the code and replaces the C array by a vector. There is still some dark magic being done in the allocation of the vector, but that is due to the fact that index of the entries are the IDs of the photos, so large indexes are necessary to be available from the beginning.