Merge pull request #162 from cesanta/fix_async

Add malloc failure checks
Return NULL on sync connection errors