]> git.evergreen-ils.org Git - OpenSRF.git/commit
Plug a minor memory leak that could occur when we opened a TCP connection
authorscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 14 Oct 2010 16:30:17 +0000 (16:30 +0000)
committerscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 14 Oct 2010 16:30:17 +0000 (16:30 +0000)
commit6e01eac37cf2a56a3a60fe804a98460594780324
tree0fdff17055e882fc0a3276dabb3d480a35b3ae30
parent90f6792c564760df2cf7abea34925182b40401ba
Plug a minor memory leak that could occur when we opened a TCP connection
to a server.  In practice this meant whenever we opened a Jabber session.

We call getaddrinfo() to get a dynamically allocated linked list of
addresses for a given server name.  Then we traverse the list, looking
for one that accepts streaming connections over IPV4, in order to get
an IP address.

At the end, we call freeaddrinfo() to free the linked list.

Previously we would pass to freeaddrinfo() a pointer, not to the
head of the list, but to the node that we used for getting an IP
address.  Prior nodes, if any, would leak.

Also: added calls to freeaddrinfo() in the case of early returns, to
avoid leaking the list in the event of an error.

M    src/libopensrf/socket_bundle.c

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2036 9efc2488-bf62-4759-914b-345cdb29e865
src/libopensrf/socket_bundle.c