Skip to content

sysdeps-unix: Don't leak struct addrinfo on OOM during connect()

Simon McVittie requested to merge smcv/dbus:mr143-but-unix into master

If we ran out of memory while handling connect() errors, we didn't free the linked list of struct addrinfo. Move their cleanup to the "out" phase of the function so that we always do it.

While I'm there, change the iterator variable tmp to be const, to make it more obvious that we aren't meant to free it.

This is similar to commit 00badeba (!143 (merged)) in the corresponding Windows code path, but with the refactoring from !145 (merged) included.

Signed-off-by: Simon McVittie smcv@collabora.com

Edited by Simon McVittie

Merge request reports