[os_maild] fix compiler warnings
[os_maild] fix potential nullpointer dereference
[os_maild] reduce variable scope
[os_maild] add nonnull qualifiers
Merge pull request #317 from cgzones/os_maild_

os_maild