|
From: | Aymeric Moizard |
Subject: | Re: [osip-dev] WSACleanup missing |
Date: | Thu, 8 Jan 2015 11:10:49 +0100 |
hi aymeric,
happy new year !
let me try it one more time:
the current eXosip behaviour is asymmetrical – eXosip does call WSAStartup, but never calls WSACleanup.
this is ‘sub-optimal’ in my opinion – either call both, or none.
fact is, that WSAStartup and WSACleanup are counting internally how often they have been called.
so, the first WSAStartup initializes the sockets, the last WSACleanup destroys them.
every application and lib that uses sockets under windows shall call itself WSAStartup and WSACleanup;
eXosip does – so it shall call both functions.
independent of the applications, which may use the windows socket lib or not.
when calling WSAStartup without WSACleanup any memleak-search-tool identifies this as leak,
because WSAStartup does some memory allocaction.
btw, I don’t know if there is a limit, how often WSAStartup may be called.
if eXosip_init permanently fails, let’s assume for days and weeks, it might come to a point, where
this internal counter may be exhausted …
I don’t think you break existing application – it just fixes a memleak.
br,
christoph
From: Aymeric Moizard [mailto:address@hidden]
Sent: Dienstag, 06. Jänner 2015 15:53
To: FEICHTER Christoph
Cc: address@hidden
Subject: Re: [osip-dev] WSACleanup missing
I don't think this can be integrated without breaking some existing
applications. A clean change would be to remove the WSAStartup
which would also break apps...
So... I prefer to keep everything unchanged on that topic!
Rejected ;(
Not your fault ;)
Aymeric
2014-12-22 12:25 GMT+01:00 FEICHTER Christoph <address@hidden>:
hi aymeric,
one more improvement for eXosip:
since eXosip calls WSAStartup, but never WSACleanup, this causes a memory/handle leak.
I would suggest to add the following in eXosip_quit:
…
eXtl_udp.tl_free (excontext);
eXtl_tcp.tl_free (excontext);
#ifdef HAVE_OPENSSL_SSL_H
#if !(OPENSSL_VERSION_NUMBER < 0x00908000L)
eXtl_dtls.tl_free (excontext);
#endif
eXtl_tls.tl_free (excontext);
#endif
memset (excontext, 0, sizeof (eXosip_t));
excontext->j_stop_ua = -1;
#ifdef WIN32
WSACleanup();
#endif
return;
}
br,
Christoph
_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev
--
Antisip - http://www.antisip.com
[Prev in Thread] | Current Thread | [Next in Thread] |