add all adresses
silly mistake
removed a mem leak
more frees added, more robust error handling