Fix error introduced in yesterday's commit.

Check for atom is invalid, since it's an iterator, not a pointer.
Make sure to allow for NULL termination.

Bug found via Coverity.
Fix some minor potential memory leaks.

Bugs found via Coverity.
Ensure strings are null terminated with strncpy.

Bug found via Coverity.
Remove blank-line code, which potentially reads past buffer length.
Add defensive check in case OBMol->BeginAtom returns NULL.
Slightly cleaner analysis of needed NULL checks from yesterday.
Hide false positive from Coverity.
Don't bother to deference atom before deleting, we know it's valid.
Be explicit about if/else statements by checking all flow logic.

Potential bugs found by Coverity scan.