Indeed I noticed that the man pages are a bit fuzzy for the failure case, but couldn't find any real-world usage that frees in case of failure. Anyway I was going again through the pull requests and this struck me as weird. 

I guess that on your linux box the "failure that should be freed" case happens when looking up port number > 32768 like you describe in the bug report?