Add malloc failure checks

In `ns_connect` and `ns_bind`
Merge pull request #162 from cesanta/fix_async

Add malloc failure checks