freeradius-client thread safety & memleaks patch
Hello, I want to sync changes I did to CVS. No new functionality only fixes for thread-safety and fixing memory leaks. I use this code with static (shared among threads) rc_handle and experience no segfaults and no memory leaks :) Some parts of this patch we posted before, but this one combines them all and is prepared against current CVS. Changes: freeradius-client.h: - adding rad_hostent (will be used by ip_util.c) - changing functions signatures due to changes in ip_utils.c avpair.c: - using localtime_r() instead of non-reentrant localtime() - fixing minor memory leak posted by somebody else (not me) to this mail list, but not applied yet - inet_ntoa() is not reentrant, using inet_ntop() instead - gmtime_r() instead of gmtime() buildreq.c: - rc_get_id() is now simple, fast and reentrant. config.c: - getservbyname_r() instead of getservbyname() - using rad_hostent in rc_gethostby* - fixing minor memleak - serv->secret[j] is not freed ip_util.c: - using rad_hostent instead of thread-local buffer. Thread local storage is tricky and might leak in thread per request scenario - implementation of rc_ip_hostname() is copied from freeradius server. (something is wrong with current one) - using getservbyname_r() instead of getservbyname() sendserver.c: - using new rc_ip_hostname() - using rand_r() instead of rand() -- Best Regards, Alex Massover VoIP R&D TL Jajah Inc. This mail was sent via Mail-SeCure System.
Hi, The same like previous but bswap32() (in ip_utils.c) is properly wrapped in case GCC's __builtin_bswap32() is not available. Please consider this one.
-----Original Message----- From: freeradius-devel-bounces+alex=jajah.com@lists.freeradius.org [mailto:freeradius-devel-bounces+alex=jajah.com@lists.freeradius.org] On Behalf Of Alex Massover Sent: יום א 25 יולי 2010 12:30 To: freeradius-devel@lists.freeradius.org Subject: freeradius-client thread safety & memleaks patch
Hello,
I want to sync changes I did to CVS. No new functionality only fixes for thread-safety and fixing memory leaks. I use this code with static (shared among threads) rc_handle and experience no segfaults and no memory leaks :)
Some parts of this patch we posted before, but this one combines them all and is prepared against current CVS.
Changes:
freeradius-client.h: - adding rad_hostent (will be used by ip_util.c) - changing functions signatures due to changes in ip_utils.c
avpair.c: - using localtime_r() instead of non-reentrant localtime() - fixing minor memory leak posted by somebody else (not me) to this mail list, but not applied yet - inet_ntoa() is not reentrant, using inet_ntop() instead - gmtime_r() instead of gmtime()
buildreq.c: - rc_get_id() is now simple, fast and reentrant.
config.c: - getservbyname_r() instead of getservbyname() - using rad_hostent in rc_gethostby* - fixing minor memleak - serv->secret[j] is not freed
ip_util.c: - using rad_hostent instead of thread-local buffer. Thread local storage is tricky and might leak in thread per request scenario - implementation of rc_ip_hostname() is copied from freeradius server. (something is wrong with current one) - using getservbyname_r() instead of getservbyname()
sendserver.c: - using new rc_ip_hostname() - using rand_r() instead of rand()
-- Best Regards, Alex Massover VoIP R&D TL Jajah Inc.
This mail was sent via Mail-SeCure System.
This mail was received via Mail-SeCure System.
This mail was sent via Mail-SeCure System.
Sorry, this is the last time. Just used ntohl() instead of all bswap32() stuff.
-----Original Message----- From: freeradius-devel-bounces+alex=jajah.com@lists.freeradius.org [mailto:freeradius-devel-bounces+alex=jajah.com@lists.freeradius.org] On Behalf Of Alex Massover Sent: יום ב 26 יולי 2010 11:48 To: FreeRadius developers mailing list Subject: RE: freeradius-client thread safety & memleaks patch
Hi,
The same like previous but bswap32() (in ip_utils.c) is properly wrapped in case GCC's __builtin_bswap32() is not available.
Please consider this one.
-----Original Message----- From: freeradius-devel-bounces+alex=jajah.com@lists.freeradius.org [mailto:freeradius-devel-bounces+alex=jajah.com@lists.freeradius.org] On Behalf Of Alex Massover Sent: יום א 25 יולי 2010 12:30 To: freeradius-devel@lists.freeradius.org Subject: freeradius-client thread safety & memleaks patch
Hello,
I want to sync changes I did to CVS. No new functionality only fixes for thread-safety and fixing memory leaks. I use this code with static (shared among threads) rc_handle and experience no segfaults and no memory leaks :)
Some parts of this patch we posted before, but this one combines them all and is prepared against current CVS.
Changes:
freeradius-client.h: - adding rad_hostent (will be used by ip_util.c) - changing functions signatures due to changes in ip_utils.c
avpair.c: - using localtime_r() instead of non-reentrant localtime() - fixing minor memory leak posted by somebody else (not me) to this mail list, but not applied yet - inet_ntoa() is not reentrant, using inet_ntop() instead - gmtime_r() instead of gmtime()
buildreq.c: - rc_get_id() is now simple, fast and reentrant.
config.c: - getservbyname_r() instead of getservbyname() - using rad_hostent in rc_gethostby* - fixing minor memleak - serv->secret[j] is not freed
ip_util.c: - using rad_hostent instead of thread-local buffer. Thread local storage is tricky and might leak in thread per request scenario - implementation of rc_ip_hostname() is copied from freeradius server. (something is wrong with current one) - using getservbyname_r() instead of getservbyname()
sendserver.c: - using new rc_ip_hostname() - using rand_r() instead of rand()
-- Best Regards, Alex Massover VoIP R&D TL Jajah Inc.
This mail was sent via Mail-SeCure System.
This mail was received via Mail-SeCure System.
This mail was sent via Mail-SeCure System.
This mail was received via Mail-SeCure System.
This mail was sent via Mail-SeCure System.
participants (1)
-
Alex Massover