Implement memory preprocessing in leo().

This commit adds a static function, process_memory(), which processes
new and preexisting memory files correctly. Specifically, it adds a
magic number and returns any errors.

Because there may be an error in process_error(), leo() has been changed
to return an int so that this information can be properly reported to
the caller.