X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=net.c;fp=net.c;h=70cf6a87dfb27bbba74912bb50467a0a74f966bd;hp=9435064715cd368ac6bc04e3dbac0b4c3d0b3e69;hb=ae5e9dbcaaad643039e44c85891b3d7b383b23dd;hpb=96c1687a52b775b6786841d586239e071ef139c1 diff --git a/net.c b/net.c index 94350647..70cf6a87 100644 --- a/net.c +++ b/net.c @@ -333,7 +333,14 @@ static void flowopt_setopts(int sockfd, struct flowopts *fo) } } -static void flowopt_cleanup(struct flowopts *fo) +/** + * Deallocate all resources of a flowopts structure. + * + * \param fo A pointer as returned from flowopt_new(). + * + * It's OK to pass \p NULL here in which case the function does nothing. + */ +void flowopt_cleanup(struct flowopts *fo) { struct pre_conn_opt *cur, *next; @@ -412,7 +419,7 @@ static int lookup_address(unsigned l4type, bool passive, const char *host, * * bind(2) is called on passive sockets, and connect(2) on active sockets. The * algorithm tries all possible address combinations until it succeeds. If \a - * fo is supplied, options are set and cleanup is performed. + * fo is supplied, options are set but cleanup must be performed in the caller. * * \return File descriptor on success, \p E_MAKESOCK on errors. * @@ -485,7 +492,6 @@ int makesock(unsigned l4type, bool passive, const char *host, uint16_t port_numb ret = makesock_addrinfo(l4type, passive, ai, fo); if (ai) freeaddrinfo(ai); - flowopt_cleanup(fo); if (ret < 0) { PARA_ERROR_LOG("can not create %s socket %s#%d.\n", layer4_name(l4type), host? host : (passive?