core: don't leak ip in uwsgi_open_and_read()

While at it convert malloc() to uwsgi_malloc() to cleanup error
handling.

Reported by Coverity Scan as CID #971018.